summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-09-10 18:04:34 +0200
committernsensfel <SpamShield0@noot-noot.org>2018-09-10 18:04:34 +0200
commit4089e04b953ce2799d839d841278446d7f0b4c32 (patch)
treee1877866c559544a97a4557cc99c025184f122c1 /src
parent04e4ce4137fe3ffb0ccc6dc8635db3e202517945 (diff)
character -> roster-editor
Diffstat (limited to 'src')
-rw-r--r--src/character/src/Struct/Armor.elm177
-rw-r--r--src/character/src/Struct/Statistics.elm176
-rw-r--r--src/character/src/Struct/UI.elm135
-rw-r--r--src/character/src/Struct/Weapon.elm248
-rw-r--r--src/character/src/Update/HandleServerReply.elm230
-rw-r--r--src/roster-editor/Makefile (renamed from src/character/Makefile)0
-rw-r--r--src/roster-editor/elm-package.json (renamed from src/character/elm-package.json)0
-rw-r--r--src/roster-editor/src/Comm/AddArmor.elm (renamed from src/character/src/Comm/AddArmor.elm)0
-rw-r--r--src/roster-editor/src/Comm/AddChar.elm (renamed from src/character/src/Comm/AddChar.elm)0
-rw-r--r--src/roster-editor/src/Comm/AddWeapon.elm (renamed from src/character/src/Comm/AddWeapon.elm)0
-rw-r--r--src/roster-editor/src/Comm/LoadRoster.elm (renamed from src/character/src/Comm/LoadRoster.elm)5
-rw-r--r--src/roster-editor/src/Comm/Send.elm (renamed from src/character/src/Comm/Send.elm)13
-rw-r--r--src/roster-editor/src/Constants/IO.elm.m4 (renamed from src/character/src/Constants/IO.elm.m4)4
-rw-r--r--src/roster-editor/src/Constants/Movement.elm10
-rw-r--r--src/roster-editor/src/Constants/UI.elm16
-rw-r--r--src/roster-editor/src/ElmModule/Init.elm (renamed from src/character/src/ElmModule/Init.elm)0
-rw-r--r--src/roster-editor/src/ElmModule/Subscriptions.elm (renamed from src/character/src/ElmModule/Subscriptions.elm)2
-rw-r--r--src/roster-editor/src/ElmModule/Update.elm (renamed from src/character/src/ElmModule/Update.elm)10
-rw-r--r--src/roster-editor/src/ElmModule/View.elm (renamed from src/character/src/ElmModule/View.elm)29
-rw-r--r--src/roster-editor/src/Main.elm (renamed from src/character/src/Main.elm)0
-rw-r--r--src/roster-editor/src/Struct/Armor.elm70
-rw-r--r--src/roster-editor/src/Struct/Attributes.elm (renamed from src/character/src/Struct/Attributes.elm)69
-rw-r--r--src/roster-editor/src/Struct/Character.elm (renamed from src/character/src/Struct/Character.elm)101
-rw-r--r--src/roster-editor/src/Struct/DamageType.elm55
-rw-r--r--src/roster-editor/src/Struct/Error.elm (renamed from src/character/src/Struct/Error.elm)0
-rw-r--r--src/roster-editor/src/Struct/Event.elm (renamed from src/character/src/Struct/Event.elm)22
-rw-r--r--src/roster-editor/src/Struct/HelpRequest.elm (renamed from src/character/src/Struct/HelpRequest.elm)0
-rw-r--r--src/roster-editor/src/Struct/Model.elm (renamed from src/character/src/Struct/Model.elm)69
-rw-r--r--src/roster-editor/src/Struct/Omnimods.elm180
-rw-r--r--src/roster-editor/src/Struct/ServerReply.elm (renamed from src/character/src/Struct/ServerReply.elm)10
-rw-r--r--src/roster-editor/src/Struct/Statistics.elm210
-rw-r--r--src/roster-editor/src/Struct/UI.elm52
-rw-r--r--src/roster-editor/src/Struct/Weapon.elm99
-rw-r--r--src/roster-editor/src/Struct/WeaponSet.elm (renamed from src/character/src/Struct/WeaponSet.elm)0
-rw-r--r--src/roster-editor/src/Update/DisplayCharacterInfo.elm (renamed from src/character/src/Update/DisplayCharacterInfo.elm)0
-rw-r--r--src/roster-editor/src/Update/GoToMainMenu.elm24
-rw-r--r--src/roster-editor/src/Update/HandleServerReply.elm174
-rw-r--r--src/roster-editor/src/Update/SelectCharacter.elm (renamed from src/character/src/Update/SelectCharacter.elm)2
-rw-r--r--src/roster-editor/src/Update/SelectTab.elm (renamed from src/character/src/Update/SelectTab.elm)0
-rw-r--r--src/roster-editor/src/Update/SendLoadRosterRequest.elm (renamed from src/character/src/Update/SendLoadRosterRequest.elm)9
-rw-r--r--src/roster-editor/src/Update/SetRequestedHelp.elm (renamed from src/character/src/Update/SetRequestedHelp.elm)0
-rw-r--r--src/roster-editor/src/View/Character.elm (renamed from src/character/src/View/Character.elm)0
-rw-r--r--src/roster-editor/src/View/CharacterIcon.elm218
-rw-r--r--src/roster-editor/src/View/Controlled.elm (renamed from src/character/src/View/Controlled.elm)37
-rw-r--r--src/roster-editor/src/View/Controlled/CharacterCard.elm (renamed from src/character/src/View/Controlled/CharacterCard.elm)311
-rw-r--r--src/roster-editor/src/View/Controlled/ManualControls.elm (renamed from src/character/src/View/Controlled/ManualControls.elm)0
-rw-r--r--src/roster-editor/src/View/Controlled/Targets.elm (renamed from src/character/src/View/Controlled/Targets.elm)0
-rw-r--r--src/roster-editor/src/View/CurrentTab.elm40
-rw-r--r--src/roster-editor/src/View/Gauge.elm (renamed from src/character/src/View/Gauge.elm)0
-rw-r--r--src/roster-editor/src/View/MainMenu.elm (renamed from src/character/src/View/MainMenu.elm)22
-rw-r--r--src/roster-editor/src/View/MessageBoard.elm (renamed from src/character/src/View/MessageBoard.elm)0
-rw-r--r--src/roster-editor/src/View/MessageBoard/Animator.elm (renamed from src/character/src/View/MessageBoard/Animator.elm)0
-rw-r--r--src/roster-editor/src/View/MessageBoard/Animator/Attack.elm (renamed from src/character/src/View/MessageBoard/Animator/Attack.elm)0
-rw-r--r--src/roster-editor/src/View/MessageBoard/Error.elm (renamed from src/character/src/View/MessageBoard/Error.elm)0
-rw-r--r--src/roster-editor/src/View/MessageBoard/Help.elm (renamed from src/character/src/View/MessageBoard/Help.elm)0
-rw-r--r--src/roster-editor/src/View/MessageBoard/Help/Guide.elm (renamed from src/character/src/View/MessageBoard/Help/Guide.elm)35
-rw-r--r--src/roster-editor/src/View/MessageBoard/Help/Rank.elm (renamed from src/character/src/View/MessageBoard/Help/Rank.elm)0
-rw-r--r--src/roster-editor/src/View/SubMenu.elm (renamed from src/character/src/View/SubMenu.elm)0
-rw-r--r--src/roster-editor/src/View/SubMenu/Characters.elm (renamed from src/character/src/View/SubMenu/Characters.elm)0
-rw-r--r--src/roster-editor/src/View/SubMenu/Settings.elm (renamed from src/character/src/View/SubMenu/Settings.elm)0
-rw-r--r--src/roster-editor/src/View/SubMenu/Status.elm (renamed from src/character/src/View/SubMenu/Status.elm)0
-rw-r--r--src/roster-editor/src/View/SubMenu/Status/CharacterInfo.elm (renamed from src/character/src/View/SubMenu/Status/CharacterInfo.elm)0
-rw-r--r--src/roster-editor/src/View/SubMenu/Status/TileInfo.elm (renamed from src/character/src/View/SubMenu/Status/TileInfo.elm)52
-rw-r--r--src/roster-editor/src/View/SubMenu/Timeline.elm (renamed from src/character/src/View/SubMenu/Timeline.elm)0
-rw-r--r--src/roster-editor/src/View/SubMenu/Timeline/Attack.elm (renamed from src/character/src/View/SubMenu/Timeline/Attack.elm)0
-rw-r--r--src/roster-editor/src/View/SubMenu/Timeline/Movement.elm (renamed from src/character/src/View/SubMenu/Timeline/Movement.elm)0
-rw-r--r--src/roster-editor/src/View/SubMenu/Timeline/PlayerDefeat.elm (renamed from src/character/src/View/SubMenu/Timeline/PlayerDefeat.elm)0
-rw-r--r--src/roster-editor/src/View/SubMenu/Timeline/PlayerTurnStart.elm (renamed from src/character/src/View/SubMenu/Timeline/PlayerTurnStart.elm)0
-rw-r--r--src/roster-editor/src/View/SubMenu/Timeline/PlayerVictory.elm (renamed from src/character/src/View/SubMenu/Timeline/PlayerVictory.elm)0
-rw-r--r--src/roster-editor/src/View/SubMenu/Timeline/WeaponSwitch.elm (renamed from src/character/src/View/SubMenu/Timeline/WeaponSwitch.elm)0
-rw-r--r--src/roster-editor/www/index.html (renamed from src/character/www/index.html)2
71 files changed, 1599 insertions, 1319 deletions
diff --git a/src/character/src/Struct/Armor.elm b/src/character/src/Struct/Armor.elm
deleted file mode 100644
index 04a0428..0000000
--- a/src/character/src/Struct/Armor.elm
+++ /dev/null
@@ -1,177 +0,0 @@
-module Struct.Armor exposing
- (
- Type,
- Ref,
- Category(..),
- new,
- get_id,
- get_name,
- get_category,
- get_resistance_to,
- get_image_id,
- decoder,
- none,
- apply_to_attributes
- )
-
--- Elm -------------------------------------------------------------------------
-import Json.Decode
-import Json.Decode.Pipeline
-
--- Map -------------------------------------------------------------------
-import Struct.Attributes
-import Struct.Weapon
-
---------------------------------------------------------------------------------
--- TYPES -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-type alias PartiallyDecoded =
- {
- id : Int,
- nam : String,
- ct : String,
- cf : Float
- }
-
-type alias Type =
- {
- id : Int,
- name : String,
- category : Category,
- coef : Float
- }
-
-type alias Ref = Int
-
-type Category =
- Kinetic
- | Leather
- | Chain
- | Plate
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-finish_decoding : PartiallyDecoded -> Type
-finish_decoding add_armor =
- {
- id = add_armor.id,
- name = add_armor.nam,
- category =
- (
- case add_armor.ct of
- "k" -> Kinetic
- "c" -> Chain
- "p" -> Plate
- _ -> Leather
- ),
- coef = add_armor.cf
- }
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-new : Int -> String -> Category -> Float -> Type
-new id name category coef =
- {
- id = id,
- name = name,
- category = category,
- coef = coef
- }
-
-get_id : Type -> Ref
-get_id ar = ar.id
-
-get_name : Type -> String
-get_name ar = ar.name
-
-get_category : Type -> String
-get_category ar = ar.name
-
-get_image_id : Type -> String
-get_image_id ar = (toString ar.id)
-
-get_resistance_to : Struct.Weapon.DamageType -> Type -> Int
-get_resistance_to dmg_type ar =
- (ceiling
- (
- ar.coef
- *
- (
- case (dmg_type, ar.category) of
- (Struct.Weapon.Slash, Kinetic) -> 0.0
- (Struct.Weapon.Slash, Leather) -> 20.0
- (Struct.Weapon.Slash, Chain) -> 30.0
- (Struct.Weapon.Slash, Plate) -> 30.0
- (Struct.Weapon.Blunt, Kinetic) -> 30.0
- (Struct.Weapon.Blunt, Leather) -> 20.0
- (Struct.Weapon.Blunt, Chain) -> 20.0
- (Struct.Weapon.Blunt, Plate) -> 20.0
- (Struct.Weapon.Pierce, Kinetic) -> 20.0
- (Struct.Weapon.Pierce, Leather) -> 20.0
- (Struct.Weapon.Pierce, Chain) -> 20.0
- (Struct.Weapon.Pierce, Plate) -> 30.0
- )
- )
- )
-
-apply_to_attributes : Type -> Struct.Attributes.Type -> Struct.Attributes.Type
-apply_to_attributes ar atts =
- let
- impact = (-1 * (ceiling (20.0 * ar.coef)))
- half_impact = (-1 * (ceiling (10.0 * ar.coef)))
- in
- case ar.category of
- Kinetic -> (Struct.Attributes.mod_mind impact atts)
- Leather ->
- (Struct.Attributes.mod_constitution
- half_impact
- (Struct.Attributes.mod_dexterity
- half_impact
- atts
- )
- )
-
- Chain ->
- (Struct.Attributes.mod_constitution
- half_impact
- (Struct.Attributes.mod_dexterity
- half_impact
- (Struct.Attributes.mod_speed impact atts)
- )
- )
-
- Plate ->
- (Struct.Attributes.mod_constitution
- half_impact
- (Struct.Attributes.mod_dexterity
- half_impact
- (Struct.Attributes.mod_speed
- impact
- (Struct.Attributes.mod_strength impact atts)
- )
- )
- )
-
-decoder : (Json.Decode.Decoder Type)
-decoder =
- (Json.Decode.map
- (finish_decoding)
- (Json.Decode.Pipeline.decode
- PartiallyDecoded
- |> (Json.Decode.Pipeline.required "id" Json.Decode.int)
- |> (Json.Decode.Pipeline.required "nam" Json.Decode.string)
- |> (Json.Decode.Pipeline.required "ct" Json.Decode.string)
- |> (Json.Decode.Pipeline.required "cf" Json.Decode.float)
- )
- )
-
-none : Type
-none =
- (new
- 0
- "None"
- Leather
- 0.0
- )
diff --git a/src/character/src/Struct/Statistics.elm b/src/character/src/Struct/Statistics.elm
deleted file mode 100644
index aa3de39..0000000
--- a/src/character/src/Struct/Statistics.elm
+++ /dev/null
@@ -1,176 +0,0 @@
-module Struct.Statistics exposing
- (
- Type,
- get_movement_points,
- get_max_health,
- get_dodges,
- get_parries,
- get_damage_min,
- get_damage_max,
- get_accuracy,
- get_double_hits,
- get_critical_hits,
- new
- )
-
--- Elm -------------------------------------------------------------------------
-import List
-
--- Map -------------------------------------------------------------------
-import Struct.Attributes
-import Struct.Armor
-import Struct.Weapon
-import Struct.WeaponSet
-
---------------------------------------------------------------------------------
--- TYPES -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-type alias Type =
- {
- movement_points : Int,
- max_health : Int,
- dodges : Int,
- parries : Int,
- damage_min : Int,
- damage_max : Int,
- accuracy : Int,
- double_hits : Int,
- critical_hits : Int
- }
-
---------------------------------------------------------------------------------
--- 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)))
-
-already_high_slow_growth : Int -> Int
-already_high_slow_growth v =
- (float_to_int
- (30.0 * (logBase 2.718281828459 (((toFloat v) + 5.0)/4.0)))
- )
-
-damage_base_mod : Float -> Float
-damage_base_mod str = (((str^1.8)/2000.0) - 0.75)
-
-apply_damage_base_mod : Float -> Float -> Int
-apply_damage_base_mod bmod dmg =
- (max 0 (float_to_int (dmg + (bmod * dmg))))
-
---------------------------------------------------------------------------------
--- 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_damage_min : Type -> Int
-get_damage_min t = t.damage_min
-
-get_damage_max : Type -> Int
-get_damage_max t = t.damage_max
-
-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
-
-new : (
- Struct.Attributes.Type ->
- Struct.WeaponSet.Type ->
- Struct.Armor.Type ->
- Type
- )
-new att wp_set ar =
- let
- active_weapon = (Struct.WeaponSet.get_active_weapon wp_set)
- actual_att =
- (Struct.Armor.apply_to_attributes
- ar
- (Struct.Weapon.apply_to_attributes active_weapon att)
- )
- constitution = (Struct.Attributes.get_constitution actual_att)
- dexterity = (Struct.Attributes.get_dexterity actual_att)
- intelligence = (Struct.Attributes.get_intelligence actual_att)
- mind = (Struct.Attributes.get_mind actual_att)
- speed = (Struct.Attributes.get_speed actual_att)
- strength = (Struct.Attributes.get_strength actual_att)
- dmg_bmod = (damage_base_mod (toFloat strength))
- 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 =
- (clamp
- 0
- 100
- (sudden_exp_growth_f
- (average
- [dexterity, mind, speed]
- )
- )
- ),
- parries =
- (clamp
- 0
- 75
- (sudden_exp_growth_f
- (average [dexterity, intelligence, speed, strength])
- )
- ),
- damage_min =
- (apply_damage_base_mod
- dmg_bmod
- (toFloat (Struct.Weapon.get_min_damage active_weapon))
- ),
- damage_max =
- (apply_damage_base_mod
- dmg_bmod
- (toFloat (Struct.Weapon.get_max_damage active_weapon))
- ),
- accuracy = (sudden_squared_growth dexterity),
- double_hits =
- (clamp 0 100 (sudden_squared_growth_f (average [mind, speed]))),
- critical_hits =
- (clamp 0 100 (sudden_squared_growth intelligence))
- }
diff --git a/src/character/src/Struct/UI.elm b/src/character/src/Struct/UI.elm
deleted file mode 100644
index 4837434..0000000
--- a/src/character/src/Struct/UI.elm
+++ /dev/null
@@ -1,135 +0,0 @@
-module Struct.UI exposing
- (
- Type,
- Tab(..),
- Action(..),
- default,
- -- Zoom
- get_zoom_level,
- reset_zoom_level,
- mod_zoom_level,
- -- Tab
- try_getting_displayed_tab,
- set_displayed_tab,
- reset_displayed_tab,
- to_string,
- get_all_tabs,
- -- Navigator
- try_getting_displayed_nav,
- set_displayed_nav,
- reset_displayed_nav,
- -- Manual Controls
- has_manual_controls_enabled,
- -- Previous Action
- get_previous_action,
- set_previous_action
- )
-
--- Map -------------------------------------------------------------------
-import Struct.Location
-import Struct.Navigator
-
---------------------------------------------------------------------------------
--- TYPES -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-type Tab =
- StatusTab
- | CharactersTab
- | SettingsTab
- | TimelineTab
-
-type Action =
- UsedManualControls
- | SelectedLocation Struct.Location.Ref
- | SelectedCharacter Int
- | AttackedCharacter Int
-
-type alias Type =
- {
- zoom_level : Float,
- show_manual_controls : Bool,
- displayed_tab : (Maybe Tab),
- previous_action : (Maybe Action),
- displayed_nav : (Maybe Struct.Navigator.Type)
- }
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-default : Type
-default =
- {
- zoom_level = 1.0,
- show_manual_controls = True,
- displayed_tab = Nothing,
- previous_action = Nothing,
- displayed_nav = Nothing
- }
-
--- Zoom ------------------------------------------------------------------------
-get_zoom_level : Type -> Float
-get_zoom_level ui = ui.zoom_level
-
-reset_zoom_level : Type -> Type
-reset_zoom_level ui = {ui | zoom_level = 1.0}
-
-mod_zoom_level : Float -> Type -> Type
-mod_zoom_level mod ui = {ui | zoom_level = (mod * ui.zoom_level)}
-
--- Tab -------------------------------------------------------------------------
-try_getting_displayed_tab : Type -> (Maybe Tab)
-try_getting_displayed_tab ui = ui.displayed_tab
-
-set_displayed_tab : Tab -> Type -> Type
-set_displayed_tab tab ui = {ui | displayed_tab = (Just tab)}
-
-reset_displayed_tab : Type -> Type
-reset_displayed_tab ui = {ui | displayed_tab = Nothing}
-
-to_string : Tab -> String
-to_string tab =
- case tab of
- StatusTab -> "Status"
- CharactersTab -> "Characters"
- SettingsTab -> "Settings"
- TimelineTab -> "Timeline"
-
-get_all_tabs : (List Tab)
-get_all_tabs =
- [StatusTab, CharactersTab, SettingsTab, TimelineTab]
-
--- Navigator -------------------------------------------------------------------
-try_getting_displayed_nav : Type -> (Maybe Struct.Navigator.Type)
-try_getting_displayed_nav ui = ui.displayed_nav
-
-set_displayed_nav : Struct.Navigator.Type -> Type -> Type
-set_displayed_nav nav ui = {ui | displayed_nav = (Just nav)}
-
-reset_displayed_nav : Type -> Type
-reset_displayed_nav ui = {ui | displayed_nav = Nothing}
-
--- ManualControls --------------------------------------------------------------
-has_manual_controls_enabled : Type -> Bool
-has_manual_controls_enabled ui = ui.show_manual_controls
-
-toggle_manual_controls : Type -> Type
-toggle_manual_controls ui =
- if (ui.show_manual_controls)
- then
- {ui | show_manual_controls = False}
- else
- {ui | show_manual_controls = True}
-
-set_enable_manual_controls : Bool -> Type -> Type
-set_enable_manual_controls val ui = {ui | show_manual_controls = val}
-
--- Previous Action -------------------------------------------------------------
-set_previous_action : (Maybe Action) -> Type -> Type
-set_previous_action act ui = {ui | previous_action = act}
-
-get_previous_action : Type -> (Maybe Action)
-get_previous_action ui = ui.previous_action
diff --git a/src/character/src/Struct/Weapon.elm b/src/character/src/Struct/Weapon.elm
deleted file mode 100644
index d572ed6..0000000
--- a/src/character/src/Struct/Weapon.elm
+++ /dev/null
@@ -1,248 +0,0 @@
-module Struct.Weapon exposing
- (
- Type,
- Ref,
- RangeType(..),
- RangeModifier(..),
- DamageType(..),
- DamageModifier(..),
- new,
- get_id,
- get_name,
- get_range_type,
- get_range_modifier,
- get_damage_type,
- get_damage_modifier,
- get_attack_range,
- get_defense_range,
- get_max_damage,
- get_min_damage,
- decoder,
- none,
- apply_to_attributes
- )
-
--- Elm -------------------------------------------------------------------------
-import Json.Decode
-import Json.Decode.Pipeline
-
--- Map -------------------------------------------------------------------
-import Struct.Attributes
-
---------------------------------------------------------------------------------
--- TYPES -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-type alias PartiallyDecoded =
- {
- id : Int,
- nam : String,
- rt : String,
- rm : String,
- dt : String,
- dm : String,
- cf : Float
- }
-
-type alias Type =
- {
- id : Int,
- name : String,
- coef : Float,
- range_type : RangeType,
- range_mod : RangeModifier,
- dmg_type : DamageType,
- dmg_mod : DamageModifier,
- def_range : Int,
- atk_range : Int,
- dmg_min : Int,
- dmg_max : Int
- }
-
-type alias Ref = Int
-
-type RangeType = Ranged | Melee
-type RangeModifier = Long | Short
--- Having multiple types at the same time, like Warframe does, would be nice.
-type DamageType = Slash | Blunt | Pierce
-type DamageModifier = Heavy | Light
-
-type alias WeaponType =
- {
- range : RangeType,
- range_mod : RangeModifier,
- dmg_type : DamageType
- }
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_ranges : RangeType -> RangeModifier -> (Int, Int)
-get_ranges rt rm =
- case (rt, rm) of
- (Ranged, Long) -> (2, 6)
- (Ranged, Short) -> (1, 4)
- (Melee, Long) -> (0, 2)
- (Melee, Short) -> (0, 1)
-
-get_damages : Float -> RangeType -> DamageModifier -> (Int, Int)
-get_damages coef rt dm =
- case (rt, dm) of
- (Ranged, Heavy) -> ((ceiling (15.0 * coef)), (ceiling (30.0 * coef)))
- (Ranged, Light) -> ((ceiling (10.0 * coef)), (ceiling (25.0 * coef)))
- (Melee, Heavy) -> ((ceiling (20.0 * coef)), (ceiling (35.0 * coef)))
- (Melee, Light) -> ((ceiling (15.0 * coef)), (ceiling (30.0 * coef)))
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-new : (
- Int ->
- String ->
- Float ->
- RangeType ->
- RangeModifier ->
- DamageType ->
- DamageModifier ->
- Type
- )
-new
- id name coef
- range_type range_mod
- dmg_type dmg_mod
- =
- let
- (def_range, atk_range) = (get_ranges range_type range_mod)
- (dmg_min, dmg_max) = (get_damages coef range_type dmg_mod)
- in
- {
- id = id,
- name = name,
- coef = coef,
- range_type = range_type,
- range_mod = range_mod,
- dmg_type = dmg_type,
- dmg_mod = dmg_mod,
- def_range = def_range,
- atk_range = atk_range,
- dmg_min = dmg_min,
- dmg_max = dmg_max
- }
-
-get_id : Type -> Int
-get_id wp = wp.id
-
-get_name : Type -> String
-get_name wp = wp.name
-
-get_range_type : Type -> RangeType
-get_range_type wp = wp.range_type
-
-get_range_modifier : Type -> RangeModifier
-get_range_modifier wp = wp.range_mod
-
-get_damage_type : Type -> DamageType
-get_damage_type wp = wp.dmg_type
-
-get_damage_modifier : Type -> DamageModifier
-get_damage_modifier wp = wp.dmg_mod
-
-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_max_damage : Type -> Int
-get_max_damage wp = wp.dmg_max
-
-get_min_damage : Type -> Int
-get_min_damage wp = wp.dmg_min
-
-apply_to_attributes : Type -> Struct.Attributes.Type -> Struct.Attributes.Type
-apply_to_attributes wp atts =
- let
- impact = (20.0 * wp.coef)
- full_impact = (-1 * (ceiling impact))
- quarter_impact = (-1 * (ceiling (impact / 4.0)))
- in
- case (wp.range_mod, wp.dmg_mod) of
- (Long, Heavy) ->
- (Struct.Attributes.mod_dexterity
- full_impact
- (Struct.Attributes.mod_speed full_impact atts)
- )
-
- (Long, Light) ->
- (Struct.Attributes.mod_dexterity
- full_impact
- (Struct.Attributes.mod_speed quarter_impact atts)
- )
-
- (Short, Heavy) ->
- (Struct.Attributes.mod_dexterity
- quarter_impact
- (Struct.Attributes.mod_speed full_impact atts)
- )
-
- (Short, Light) ->
- (Struct.Attributes.mod_dexterity
- quarter_impact
- (Struct.Attributes.mod_speed quarter_impact atts)
- )
-
-finish_decoding : PartiallyDecoded -> Type
-finish_decoding add_weapon =
- (new
- add_weapon.id
- add_weapon.nam
- add_weapon.cf
- (
- case add_weapon.rt of
- "m" -> Melee
- _ -> Ranged
- )
- (
- case add_weapon.rm of
- "l" -> Long
- _ -> Short
- )
- (
- case add_weapon.dt of
- "s" -> Slash
- "p" -> Pierce
- _ -> Blunt
- )
- (
- case add_weapon.dm of
- "l" -> Light
- _ -> Heavy
- )
- )
-
-decoder : (Json.Decode.Decoder Type)
-decoder =
- (Json.Decode.map
- (finish_decoding)
- (Json.Decode.Pipeline.decode
- PartiallyDecoded
- |> (Json.Decode.Pipeline.required "id" Json.Decode.int)
- |> (Json.Decode.Pipeline.required "nam" Json.Decode.string)
- |> (Json.Decode.Pipeline.required "rt" Json.Decode.string)
- |> (Json.Decode.Pipeline.required "rm" Json.Decode.string)
- |> (Json.Decode.Pipeline.required "dt" Json.Decode.string)
- |> (Json.Decode.Pipeline.required "dm" Json.Decode.string)
- |> (Json.Decode.Pipeline.required "cf" Json.Decode.float)
- )
- )
-
-none : Type
-none =
- (new
- 0
- "None"
- 0.0
- Melee
- Short
- Blunt
- Light
- )
diff --git a/src/character/src/Update/HandleServerReply.elm b/src/character/src/Update/HandleServerReply.elm
deleted file mode 100644
index ff6cc67..0000000
--- a/src/character/src/Update/HandleServerReply.elm
+++ /dev/null
@@ -1,230 +0,0 @@
-module Update.HandleServerReply exposing (apply_to)
-
--- Elm -------------------------------------------------------------------------
-import Array
-
-import Delay
-
-import Dict
-
-import Http
-
-import Time
-
--- Map -------------------------------------------------------------------
-import Struct.Armor
-import Struct.Map
-import Struct.Character
-import Struct.Error
-import Struct.Event
-import Struct.Model
-import Struct.ServerReply
-import Struct.Tile
-import Struct.TurnResult
-import Struct.TurnResultAnimator
-import Struct.UI
-import Struct.Weapon
-
---------------------------------------------------------------------------------
--- TYPES -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-weapon_getter : Struct.Model.Type -> Struct.Weapon.Ref -> Struct.Weapon.Type
-weapon_getter model ref =
- case (Dict.get ref model.weapons) of
- (Just w) -> w
- Nothing -> Struct.Weapon.none
-
-armor_getter : Struct.Model.Type -> Struct.Armor.Ref -> Struct.Armor.Type
-armor_getter model ref =
- case (Dict.get ref model.armors) of
- (Just w) -> w
- Nothing -> Struct.Armor.none
-
------------
-
-add_armor : (
- Struct.Armor.Type ->
- (Struct.Model.Type, (Maybe Struct.Error.Type)) ->
- (Struct.Model.Type, (Maybe Struct.Error.Type))
- )
-add_armor ar current_state =
- case current_state of
- (_, (Just _)) -> current_state
- (model, _) -> ((Struct.Model.add_armor ar model), Nothing)
-
-add_tile : (
- Struct.Tile.Type ->
- (Struct.Model.Type, (Maybe Struct.Error.Type)) ->
- (Struct.Model.Type, (Maybe Struct.Error.Type))
- )
-add_tile tl current_state =
- case current_state of
- (_, (Just _)) -> current_state
- (model, _) -> ((Struct.Model.add_tile tl model), Nothing)
-
-add_weapon : (
- Struct.Weapon.Type ->
- (Struct.Model.Type, (Maybe Struct.Error.Type)) ->
- (Struct.Model.Type, (Maybe Struct.Error.Type))
- )
-add_weapon wp current_state =
- case current_state of
- (_, (Just _)) -> current_state
- (model, _) -> ((Struct.Model.add_weapon wp model), Nothing)
-
-add_character : (
- (Struct.Character.Type, Int, Int, Int) ->
- (Struct.Model.Type, (Maybe Struct.Error.Type)) ->
- (Struct.Model.Type, (Maybe Struct.Error.Type))
- )
-add_character char_and_refs current_state =
- case current_state of
- (_, (Just _)) -> current_state
- (model, _) ->
- let
- (char, awp_ref, swp_ref, ar_ref) = char_and_refs
- awp = (weapon_getter model awp_ref)
- swp = (weapon_getter model swp_ref)
- ar = (armor_getter model ar_ref)
- in
- (
- (Struct.Model.add_character
- (Struct.Character.fill_missing_equipment awp swp ar char)
- model
- ),
- Nothing
- )
-
-set_map : (
- Struct.Map.Type ->
- (Struct.Model.Type, (Maybe Struct.Error.Type)) ->
- (Struct.Model.Type, (Maybe Struct.Error.Type))
- )
-set_map map current_state =
- case current_state of
- (_, (Just _)) -> current_state
- (model, _) ->
- (
- {model |
- map =
- (Struct.Map.solve_tiles model.tiles map)
- },
- Nothing
- )
-
-add_to_timeline : (
- (List Struct.TurnResult.Type) ->
- (Struct.Model.Type, (Maybe Struct.Error.Type)) ->
- (Struct.Model.Type, (Maybe Struct.Error.Type))
- )
-add_to_timeline turn_results current_state =
- case current_state of
- (_, (Just _)) -> current_state
-
- (model, _) ->
- (
- {model |
- animator =
- (Struct.TurnResultAnimator.maybe_new
- (List.reverse turn_results)
- False
- ),
- timeline =
- (Array.append
- (Array.fromList turn_results)
- model.timeline
- ),
- ui =
- (Struct.UI.set_displayed_tab
- Struct.UI.TimelineTab
- model.ui
- )
- },
- Nothing
- )
-
-set_timeline : (
- (List Struct.TurnResult.Type) ->
- (Struct.Model.Type, (Maybe Struct.Error.Type)) ->
- (Struct.Model.Type, (Maybe Struct.Error.Type))
- )
-set_timeline turn_results current_state =
- case current_state of
- (_, (Just _)) -> current_state
-
- (model, _) ->
- (
- {model | timeline = (Array.fromList turn_results)},
- Nothing
- )
-
-apply_command : (
- Struct.ServerReply.Type ->
- (Struct.Model.Type, (Maybe Struct.Error.Type)) ->
- (Struct.Model.Type, (Maybe Struct.Error.Type))
- )
-apply_command command current_state =
- case command of
- (Struct.ServerReply.AddWeapon wp) ->
- (add_weapon wp current_state)
-
- (Struct.ServerReply.AddArmor ar) ->
- (add_armor ar current_state)
-
- (Struct.ServerReply.AddTile tl) ->
- (add_tile tl current_state)
-
- (Struct.ServerReply.AddCharacter char) ->
- (add_character char current_state)
-
- (Struct.ServerReply.SetMap map) ->
- (set_map map current_state)
-
- (Struct.ServerReply.TurnResults results) ->
- (add_to_timeline results current_state)
-
- (Struct.ServerReply.SetTimeline timeline) ->
- (set_timeline timeline current_state)
-
- Struct.ServerReply.Okay -> current_state
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-apply_to : (
- Struct.Model.Type ->
- (Result Http.Error (List Struct.ServerReply.Type)) ->
- (Struct.Model.Type, (Cmd Struct.Event.Type))
- )
-apply_to model query_result =
- case query_result of
- (Result.Err error) ->
- (
- (Struct.Model.invalidate
- (Struct.Error.new Struct.Error.Networking (toString error))
- model
- ),
- Cmd.none
- )
-
- (Result.Ok commands) ->
- let
- new_model =
- (
- case (List.foldl (apply_command) (model, Nothing) commands) of
- (updated_model, Nothing) -> updated_model
- (_, (Just error)) -> (Struct.Model.invalidate error model)
- )
- in
- (
- new_model,
- if (new_model.animator == Nothing)
- then
- Cmd.none
- else
- (Delay.after 1 Time.millisecond Struct.Event.AnimationEnded)
- )
diff --git a/src/character/Makefile b/src/roster-editor/Makefile
index 3b58a08..3b58a08 100644
--- a/src/character/Makefile
+++ b/src/roster-editor/Makefile
diff --git a/src/character/elm-package.json b/src/roster-editor/elm-package.json
index d62239e..d62239e 100644
--- a/src/character/elm-package.json
+++ b/src/roster-editor/elm-package.json
diff --git a/src/character/src/Comm/AddArmor.elm b/src/roster-editor/src/Comm/AddArmor.elm
index 480b823..480b823 100644
--- a/src/character/src/Comm/AddArmor.elm
+++ b/src/roster-editor/src/Comm/AddArmor.elm
diff --git a/src/character/src/Comm/AddChar.elm b/src/roster-editor/src/Comm/AddChar.elm
index 32227a8..32227a8 100644
--- a/src/character/src/Comm/AddChar.elm
+++ b/src/roster-editor/src/Comm/AddChar.elm
diff --git a/src/character/src/Comm/AddWeapon.elm b/src/roster-editor/src/Comm/AddWeapon.elm
index 7061dea..7061dea 100644
--- a/src/character/src/Comm/AddWeapon.elm
+++ b/src/roster-editor/src/Comm/AddWeapon.elm
diff --git a/src/character/src/Comm/LoadRoster.elm b/src/roster-editor/src/Comm/LoadRoster.elm
index 4058b6d..524605f 100644
--- a/src/character/src/Comm/LoadRoster.elm
+++ b/src/roster-editor/src/Comm/LoadRoster.elm
@@ -3,7 +3,7 @@ module Comm.LoadRoster exposing (try)
-- Elm -------------------------------------------------------------------------
import Json.Encode
--- Map -------------------------------------------------------------------
+-- Roster Editor ---------------------------------------------------------------
import Comm.Send
import Constants.IO
@@ -24,7 +24,8 @@ try_encoding model =
(Json.Encode.object
[
("stk", (Json.Encode.string model.session_token)),
- ("pid", (Json.Encode.string model.player_id))
+ ("pid", (Json.Encode.string model.player_id)),
+ ("rid", (Json.Encode.string model.roster_id))
]
)
)
diff --git a/src/character/src/Comm/Send.elm b/src/roster-editor/src/Comm/Send.elm
index 98e3ba4..ec9e359 100644
--- a/src/character/src/Comm/Send.elm
+++ b/src/roster-editor/src/Comm/Send.elm
@@ -6,14 +6,10 @@ import Http
import Json.Decode
import Json.Encode
--- Map -------------------------------------------------------------------
+--- Roster Editor --------------------------------------------------------------
import Comm.AddArmor
import Comm.AddChar
-import Comm.AddTile
import Comm.AddWeapon
-import Comm.SetMap
-import Comm.SetTimeline
-import Comm.TurnResults
import Struct.Event
import Struct.ServerReply
@@ -29,13 +25,12 @@ import Struct.Model
internal_decoder : String -> (Json.Decode.Decoder Struct.ServerReply.Type)
internal_decoder reply_type =
case reply_type of
- "add_tile" -> (Comm.AddTile.decode)
"add_armor" -> (Comm.AddArmor.decode)
"add_char" -> (Comm.AddChar.decode)
"add_weapon" -> (Comm.AddWeapon.decode)
- "set_map" -> (Comm.SetMap.decode)
- "turn_results" -> (Comm.TurnResults.decode)
- "set_timeline" -> (Comm.SetTimeline.decode)
+ "disconnected" -> (Json.Decode.succeed Struct.ServerReply.Disconnected)
+ "okay" -> (Json.Decode.succeed Struct.ServerReply.Okay)
+
other ->
(Json.Decode.fail
(
diff --git a/src/character/src/Constants/IO.elm.m4 b/src/roster-editor/src/Constants/IO.elm.m4
index c0f4a9f..c78c717 100644
--- a/src/character/src/Constants/IO.elm.m4
+++ b/src/roster-editor/src/Constants/IO.elm.m4
@@ -4,7 +4,7 @@ base_url : String
base_url = "__CONF_SERVER_URL"
roster_handler_url : String
-roster_handler_url = (base_url ++ "/handler/roster/")
+roster_handler_url = (base_url ++ "/handler/roster")
roster_loading_handler : String
-roster_loading_handler = (roster_handler_url ++ "/chr_load")
+roster_loading_handler = (map_handler_url ++ "/rst_load")
diff --git a/src/roster-editor/src/Constants/Movement.elm b/src/roster-editor/src/Constants/Movement.elm
new file mode 100644
index 0000000..a2a5c1e
--- /dev/null
+++ b/src/roster-editor/src/Constants/Movement.elm
@@ -0,0 +1,10 @@
+module Constants.Movement exposing (..)
+
+max_points : Int
+max_points = 200
+
+cost_when_occupied_tile : Int
+cost_when_occupied_tile = 201
+
+cost_when_out_of_bounds : Int
+cost_when_out_of_bounds = 255
diff --git a/src/roster-editor/src/Constants/UI.elm b/src/roster-editor/src/Constants/UI.elm
new file mode 100644
index 0000000..6a0b948
--- /dev/null
+++ b/src/roster-editor/src/Constants/UI.elm
@@ -0,0 +1,16 @@
+module Constants.UI exposing (..)
+
+tile_size : Int
+tile_size = 32
+
+local_variants_per_tile : Int
+local_variants_per_tile = 16
+
+viewer_html_id : String
+viewer_html_id = "map_viewer"
+
+half_viewer_min_width : Float
+half_viewer_min_width = 109.0
+
+half_viewer_min_height : Float
+half_viewer_min_height = 180.0
diff --git a/src/character/src/ElmModule/Init.elm b/src/roster-editor/src/ElmModule/Init.elm
index 4fccd82..4fccd82 100644
--- a/src/character/src/ElmModule/Init.elm
+++ b/src/roster-editor/src/ElmModule/Init.elm
diff --git a/src/character/src/ElmModule/Subscriptions.elm b/src/roster-editor/src/ElmModule/Subscriptions.elm
index fe276f4..198833a 100644
--- a/src/character/src/ElmModule/Subscriptions.elm
+++ b/src/roster-editor/src/ElmModule/Subscriptions.elm
@@ -2,7 +2,7 @@ module ElmModule.Subscriptions exposing (..)
-- Elm -------------------------------------------------------------------------
--- Map -------------------------------------------------------------------
+-- Roster Editor ---------------------------------------------------------------
import Struct.Model
import Struct.Event
diff --git a/src/character/src/ElmModule/Update.elm b/src/roster-editor/src/ElmModule/Update.elm
index eafac01..f9d7d38 100644
--- a/src/character/src/ElmModule/Update.elm
+++ b/src/roster-editor/src/ElmModule/Update.elm
@@ -2,7 +2,7 @@ module ElmModule.Update exposing (update)
-- Elm -------------------------------------------------------------------------
--- Map -------------------------------------------------------------------
+-- Battle ----------------------------------------------------------------------
import Struct.Event
import Struct.Model
@@ -11,6 +11,7 @@ import Update.AttackWithoutMoving
import Update.ChangeScale
import Update.DisplayCharacterInfo
import Update.EndTurn
+import Update.GoToMainMenu
import Update.HandleAnimationEnded
import Update.HandleServerReply
import Update.LookForCharacter
@@ -24,6 +25,7 @@ import Update.SetRequestedHelp
import Update.SwitchTeam
import Update.SwitchWeapon
import Update.TestAnimation
+import Update.UndoAction
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
@@ -102,5 +104,11 @@ update event model =
Struct.Event.AbortTurnRequest ->
(Update.AbortTurn.apply_to new_model)
+ Struct.Event.UndoActionRequest ->
+ (Update.UndoAction.apply_to new_model)
+
(Struct.Event.RequestedHelp help_request) ->
(Update.SetRequestedHelp.apply_to new_model help_request)
+
+ Struct.Event.GoToMainMenu ->
+ (Update.GoToMainMenu.apply_to new_model)
diff --git a/src/character/src/ElmModule/View.elm b/src/roster-editor/src/ElmModule/View.elm
index 069b0bf..3f643f5 100644
--- a/src/character/src/ElmModule/View.elm
+++ b/src/roster-editor/src/ElmModule/View.elm
@@ -11,11 +11,12 @@ import Constants.UI
import Struct.Event
import Struct.Model
-import View.Map
-import View.Controlled
import View.MessageBoard
import View.MainMenu
-import View.SubMenu
+import View.CharacterSelection
+import View.PortraitSelection
+import View.WeaponSelection
+import View.
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
@@ -32,26 +33,8 @@ view model =
]
[
(View.MainMenu.get_html),
- (Html.Lazy.lazy2
- (View.Controlled.get_html)
- model.char_turn
- model.player_ix
- ),
- (Html.div
- [
- (Html.Attributes.class "battle-container-centerer")
- ]
- [
- (Html.div
- [
- (Html.Attributes.class "battle-container"),
- (Html.Attributes.id Constants.UI.viewer_html_id)
- ]
- [(View.Map.get_html model)]
- )
- ]
- ),
- (View.SubMenu.get_html model),
+ (View.CurrentTab.get_html model),
+ (View.Controlled.get_html model),
(View.MessageBoard.get_html model)
]
)
diff --git a/src/character/src/Main.elm b/src/roster-editor/src/Main.elm
index 8140041..8140041 100644
--- a/src/character/src/Main.elm
+++ b/src/roster-editor/src/Main.elm
diff --git a/src/roster-editor/src/Struct/Armor.elm b/src/roster-editor/src/Struct/Armor.elm
new file mode 100644
index 0000000..659f2c3
--- /dev/null
+++ b/src/roster-editor/src/Struct/Armor.elm
@@ -0,0 +1,70 @@
+module Struct.Armor exposing
+ (
+ Type,
+ Ref,
+ new,
+ get_id,
+ get_name,
+ get_image_id,
+ get_omnimods,
+ decoder,
+ none
+ )
+
+-- Elm -------------------------------------------------------------------------
+import Json.Decode
+import Json.Decode.Pipeline
+
+-- Battle ----------------------------------------------------------------------
+import Struct.Omnimods
+
+--------------------------------------------------------------------------------
+-- TYPES -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+type alias Type =
+ {
+ id : Int,
+ name : String,
+ omnimods : Struct.Omnimods.Type
+ }
+
+type alias Ref = Int
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+new : Int -> 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 = (toString ar.id)
+
+get_omnimods : Type -> Struct.Omnimods.Type
+get_omnimods ar = ar.omnimods
+
+decoder : (Json.Decode.Decoder Type)
+decoder =
+ (Json.Decode.Pipeline.decode
+ Type
+ |> (Json.Decode.Pipeline.required "id" Json.Decode.int)
+ |> (Json.Decode.Pipeline.required "nam" Json.Decode.string)
+ |> (Json.Decode.Pipeline.required "omni" Struct.Omnimods.decoder)
+ )
+
+none : Type
+none = (new 0 "None" (Struct.Omnimods.new [] [] [] []))
diff --git a/src/character/src/Struct/Attributes.elm b/src/roster-editor/src/Struct/Attributes.elm
index 50b4ad4..ce871dd 100644
--- a/src/character/src/Struct/Attributes.elm
+++ b/src/roster-editor/src/Struct/Attributes.elm
@@ -1,6 +1,7 @@
module Struct.Attributes exposing
(
Type,
+ Category(..),
get_constitution,
get_dexterity,
get_intelligence,
@@ -13,19 +14,28 @@ module Struct.Attributes exposing
mod_mind,
mod_speed,
mod_strength,
+ mod,
+ get,
new,
- decoder
+ decode_category,
+ default
)
-- Elm -------------------------------------------------------------------------
-import Json.Decode
-import Json.Decode.Pipeline
--- Map -------------------------------------------------------------------
+-- Battle ----------------------------------------------------------------------
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
+type Category =
+ Constitution
+ | Dexterity
+ | Intelligence
+ | Mind
+ | Speed
+ | Strength
+
type alias Type =
{
constitution : Int,
@@ -102,6 +112,26 @@ mod_strength i 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
@@ -121,14 +151,23 @@ new con dex int min spe str =
strength = str
}
-decoder : (Json.Decode.Decoder Type)
-decoder =
- (Json.Decode.Pipeline.decode
- Type
- |> (Json.Decode.Pipeline.required "con" Json.Decode.int)
- |> (Json.Decode.Pipeline.required "dex" Json.Decode.int)
- |> (Json.Decode.Pipeline.required "int" Json.Decode.int)
- |> (Json.Decode.Pipeline.required "min" Json.Decode.int)
- |> (Json.Decode.Pipeline.required "spe" Json.Decode.int)
- |> (Json.Decode.Pipeline.required "str" Json.Decode.int)
- )
+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/character/src/Struct/Character.elm b/src/roster-editor/src/Struct/Character.elm
index f854b44..b837962 100644
--- a/src/character/src/Struct/Character.elm
+++ b/src/roster-editor/src/Struct/Character.elm
@@ -11,6 +11,7 @@ module Struct.Character exposing
get_armor,
get_armor_variation,
get_current_health,
+ get_current_omnimods,
get_sane_current_health,
set_current_health,
get_location,
@@ -25,7 +26,8 @@ module Struct.Character exposing
get_weapons,
set_weapons,
decoder,
- fill_missing_equipment
+ refresh_omnimods,
+ fill_missing_equipment_and_omnimods
)
-- Elm -------------------------------------------------------------------------
@@ -36,6 +38,7 @@ import Json.Decode.Pipeline
import Struct.Armor
import Struct.Attributes
import Struct.Location
+import Struct.Omnimods
import Struct.Statistics
import Struct.Weapon
import Struct.WeaponSet
@@ -55,10 +58,10 @@ type alias PartiallyDecoded =
pla : Int,
ena : Bool,
dea : Bool,
- att : Struct.Attributes.Type,
awp : Int,
swp : Int,
- ar : Int
+ ar : Int,
+ omni : Struct.Omnimods.Type
}
type Rank =
@@ -81,7 +84,9 @@ type alias Type =
attributes : Struct.Attributes.Type,
statistics : Struct.Statistics.Type,
weapons : Struct.WeaponSet.Type,
- armor : Struct.Armor.Type
+ armor : Struct.Armor.Type,
+ current_omnimods : Struct.Omnimods.Type,
+ permanent_omnimods : Struct.Omnimods.Type
}
--------------------------------------------------------------------------------
@@ -99,6 +104,7 @@ finish_decoding add_char =
let
weapon_set = (Struct.WeaponSet.new Struct.Weapon.none Struct.Weapon.none)
armor = Struct.Armor.none
+ default_attributes = (Struct.Attributes.default)
almost_char =
{
ix = add_char.ix,
@@ -108,13 +114,15 @@ finish_decoding add_char =
portrait = add_char.prt,
location = add_char.lc,
health = add_char.hea,
- attributes = add_char.att,
- statistics = (Struct.Statistics.new add_char.att weapon_set armor),
+ attributes = default_attributes,
+ statistics = (Struct.Statistics.new_raw default_attributes),
player_ix = add_char.pla,
enabled = add_char.ena,
defeated = add_char.dea,
weapons = weapon_set,
- armor = armor
+ armor = armor,
+ current_omnimods = (Struct.Omnimods.new [] [] [] []),
+ permanent_omnimods = add_char.omni
}
in
(almost_char, add_char.awp, add_char.swp, add_char.ar)
@@ -143,6 +151,9 @@ get_portrait_id c = c.portrait
get_current_health : Type -> Int
get_current_health c = c.health
+get_current_omnimods : Type -> Struct.Omnimods.Type
+get_current_omnimods c = c.current_omnimods
+
get_sane_current_health : Type -> Int
get_sane_current_health c = (max 0 c.health)
@@ -193,8 +204,7 @@ get_armor_variation char =
set_weapons : Struct.WeaponSet.Type -> Type -> Type
set_weapons weapons char =
{char |
- weapons = weapons,
- statistics = (Struct.Statistics.new char.attributes weapons char.armor)
+ weapons = weapons
}
decoder : (Json.Decode.Decoder (Type, Int, Int, Int))
@@ -208,31 +218,82 @@ decoder =
|> (Json.Decode.Pipeline.required "rnk" Json.Decode.string)
|> (Json.Decode.Pipeline.required "ico" Json.Decode.string)
|> (Json.Decode.Pipeline.required "prt" Json.Decode.string)
- |> (Json.Decode.Pipeline.required "lc" (Struct.Location.decoder))
+ |> (Json.Decode.Pipeline.required "lc" Struct.Location.decoder)
|> (Json.Decode.Pipeline.required "hea" Json.Decode.int)
|> (Json.Decode.Pipeline.required "pla" Json.Decode.int)
|> (Json.Decode.Pipeline.required "ena" Json.Decode.bool)
|> (Json.Decode.Pipeline.required "dea" Json.Decode.bool)
- |> (Json.Decode.Pipeline.required "att" (Struct.Attributes.decoder))
|> (Json.Decode.Pipeline.required "awp" Json.Decode.int)
|> (Json.Decode.Pipeline.required "swp" Json.Decode.int)
|> (Json.Decode.Pipeline.required "ar" Json.Decode.int)
+ |> (Json.Decode.Pipeline.required "pomni" Struct.Omnimods.decoder)
)
)
-fill_missing_equipment : (
- Struct.Weapon.Type ->
- Struct.Weapon.Type ->
- Struct.Armor.Type ->
+refresh_omnimods : (
+ (Struct.Location.Type -> Struct.Omnimods.Type) ->
Type ->
Type
)
-fill_missing_equipment awp swp ar char =
+refresh_omnimods tile_omnimods_fun char =
let
- weapon_set = (Struct.WeaponSet.new awp swp)
+ previous_max_health = (Struct.Statistics.get_max_health char.statistics)
+ current_omnimods =
+ (Struct.Omnimods.merge
+ (Struct.Weapon.get_omnimods
+ (Struct.WeaponSet.get_active_weapon char.weapons)
+ )
+ (Struct.Omnimods.merge
+ (tile_omnimods_fun char.location)
+ char.permanent_omnimods
+ )
+ )
+ current_attributes =
+ (Struct.Omnimods.apply_to_attributes
+ current_omnimods
+ (Struct.Attributes.default)
+ )
+ current_statistics =
+ (Struct.Omnimods.apply_to_statistics
+ current_omnimods
+ (Struct.Statistics.new_raw current_attributes)
+ )
+ new_max_health = (Struct.Statistics.get_max_health current_statistics)
in
{char |
- statistics = (Struct.Statistics.new char.attributes weapon_set ar),
- weapons = weapon_set,
- armor = ar
+ attributes = current_attributes,
+ statistics = current_statistics,
+ current_omnimods = current_omnimods,
+ health =
+ (clamp
+ 1
+ new_max_health
+ (round
+ (
+ ((toFloat char.health) / (toFloat previous_max_health))
+ * (toFloat new_max_health)
+ )
+ )
+ )
}
+
+fill_missing_equipment_and_omnimods : (
+ (Struct.Location.Type -> Struct.Omnimods.Type) ->
+ Struct.Weapon.Type ->
+ Struct.Weapon.Type ->
+ Struct.Armor.Type ->
+ Type ->
+ Type
+ )
+fill_missing_equipment_and_omnimods tile_omnimods_fun awp swp ar char =
+ (set_current_health
+ -- We just changed the omnimods, but already had the right health value
+ char.health
+ (refresh_omnimods
+ (tile_omnimods_fun)
+ {char |
+ weapons = (Struct.WeaponSet.new awp swp),
+ armor = ar
+ }
+ )
+ )
diff --git a/src/roster-editor/src/Struct/DamageType.elm b/src/roster-editor/src/Struct/DamageType.elm
new file mode 100644
index 0000000..b7bced7
--- /dev/null
+++ b/src/roster-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/character/src/Struct/Error.elm b/src/roster-editor/src/Struct/Error.elm
index 5f40c09..5f40c09 100644
--- a/src/character/src/Struct/Error.elm
+++ b/src/roster-editor/src/Struct/Error.elm
diff --git a/src/character/src/Struct/Event.elm b/src/roster-editor/src/Struct/Event.elm
index dedb606..e95d029 100644
--- a/src/character/src/Struct/Event.elm
+++ b/src/roster-editor/src/Struct/Event.elm
@@ -3,10 +3,8 @@ module Struct.Event exposing (Type(..), attempted)
-- Elm -------------------------------------------------------------------------
import Http
--- Map -------------------------------------------------------------------
-import Struct.Direction
+-- Roster Editor ---------------------------------------------------------------
import Struct.Error
-import Struct.Location
import Struct.ServerReply
import Struct.HelpRequest
import Struct.UI
@@ -15,26 +13,14 @@ import Struct.UI
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
type Type =
- AbortTurnRequest
- | AnimationEnded
- | AttackWithoutMovingRequest
- | CharacterInfoRequested Int
+ None
| CharacterSelected Int
- | DebugLoadBattleRequest
- | DebugTeamSwitchRequest
- | DebugTestAnimation
- | DirectionRequested Struct.Direction.Type
| Failed Struct.Error.Type
- | LookingForCharacter Int
- | None
- | ScaleChangeRequested Float
+ | GoToMainMenu
+ | RequestedHelp Struct.HelpRequest.Type
| ServerReplied (Result Http.Error (List Struct.ServerReply.Type))
| TabSelected Struct.UI.Tab
| TileSelected Struct.Location.Ref
- | CharacterOrTileSelected Struct.Location.Ref
- | TurnEnded
- | RequestedHelp Struct.HelpRequest.Type
- | WeaponSwitchRequest
attempted : (Result.Result err val) -> Type
attempted act =
diff --git a/src/character/src/Struct/HelpRequest.elm b/src/roster-editor/src/Struct/HelpRequest.elm
index a0693e2..a0693e2 100644
--- a/src/character/src/Struct/HelpRequest.elm
+++ b/src/roster-editor/src/Struct/HelpRequest.elm
diff --git a/src/character/src/Struct/Model.elm b/src/roster-editor/src/Struct/Model.elm
index d1f2fc7..3e7fc01 100644
--- a/src/character/src/Struct/Model.elm
+++ b/src/roster-editor/src/Struct/Model.elm
@@ -8,7 +8,6 @@ module Struct.Model exposing
add_weapon,
add_armor,
invalidate,
- reset,
clear_error
)
@@ -17,17 +16,16 @@ import Array
import Dict
--- Map -------------------------------------------------------------------
+-- Shared ----------------------------------------------------------------------
+import Struct.Flags
+
+-- Roster Editor ---------------------------------------------------------------
import Struct.Armor
-import Struct.Map
import Struct.Character
import Struct.CharacterTurn
import Struct.Error
-import Struct.Flags
import Struct.HelpRequest
-import Struct.Tile
-import Struct.TurnResult
-import Struct.TurnResultAnimator
+import Struct.Omnimods
import Struct.UI
import Struct.Weapon
@@ -38,12 +36,14 @@ import Util.Array
--------------------------------------------------------------------------------
type alias Type =
{
+ flags: Struct.Flags.Type,
help_request: Struct.HelpRequest.Type,
characters: (Array.Array Struct.Character.Type),
weapons: (Dict.Dict Struct.Weapon.Ref Struct.Weapon.Type),
armors: (Dict.Dict Struct.Armor.Ref Struct.Armor.Type),
error: (Maybe Struct.Error.Type),
player_id: String,
+ roster_id: String,
session_token: String,
ui: Struct.UI.Type
}
@@ -57,21 +57,38 @@ type alias Type =
--------------------------------------------------------------------------------
new : Struct.Flags.Type -> Type
new flags =
- {
- help_request = Struct.HelpRequest.None,
- characters = (Array.empty),
- weapons = (Dict.empty),
- armors = (Dict.empty),
- error = Nothing,
- player_id =
- (
- if (flags.user_id == "")
- then "0"
- else flags.user_id
- ),
- session_token = flags.token,
- ui = (Struct.UI.default)
- }
+ let
+ maybe_roster_id = (Struct.Flags.maybe_get_param "id" flags)
+ model =
+ {
+ flags = flags,
+ help_request = Struct.HelpRequest.None,
+ characters = (Array.empty),
+ weapons = (Dict.empty),
+ armors = (Dict.empty),
+ error = Nothing,
+ roster_id = "",
+ player_id =
+ (
+ if (flags.user_id == "")
+ then "0"
+ else flags.user_id
+ ),
+ session_token = flags.token,
+ ui = (Struct.UI.default)
+ }
+ in
+ case maybe_roster_id of
+ Nothing ->
+ (invalidate
+ (Struct.Error.new
+ Struct.Error.Failure
+ "Could not find roster id."
+ )
+ model
+ )
+
+ (Just id) -> {model | roster_id = id}
add_character : Struct.Character.Type -> Type -> Type
add_character char model =
@@ -105,14 +122,6 @@ add_armor ar model =
)
}
-reset : Type -> Type
-reset model =
- {model |
- help_request = Struct.HelpRequest.None,
- error = Nothing,
- ui = (Struct.UI.set_previous_action Nothing model.ui)
- }
-
update_character : Int -> Struct.Character.Type -> Type -> Type
update_character ix new_val model =
{model |
diff --git a/src/roster-editor/src/Struct/Omnimods.elm b/src/roster-editor/src/Struct/Omnimods.elm
new file mode 100644
index 0000000..5876454
--- /dev/null
+++ b/src/roster-editor/src/Struct/Omnimods.elm
@@ -0,0 +1,180 @@
+module Struct.Omnimods exposing
+ (
+ Type,
+ new,
+ merge,
+ apply_to_attributes,
+ apply_to_statistics,
+ get_attack_damage,
+ get_damage_sum,
+ get_attributes_mods,
+ get_statistics_mods,
+ get_attack_mods,
+ get_defense_mods,
+ 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)
+ (Json.Decode.list
+ (Json.Decode.map
+ (\gm -> (gm.t, gm.v))
+ (Json.Decode.Pipeline.decode
+ 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)
+ )
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+decoder : (Json.Decode.Decoder Type)
+decoder =
+ (Json.Decode.Pipeline.decode
+ 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)
+ }
+
+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
+ )
+
+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/character/src/Struct/ServerReply.elm b/src/roster-editor/src/Struct/ServerReply.elm
index 87325a5..50968f6 100644
--- a/src/character/src/Struct/ServerReply.elm
+++ b/src/roster-editor/src/Struct/ServerReply.elm
@@ -2,12 +2,9 @@ module Struct.ServerReply exposing (Type(..))
-- Elm -------------------------------------------------------------------------
--- Map -------------------------------------------------------------------
+-- Character -------------------------------------------------------------------
import Struct.Armor
-import Struct.Map
import Struct.Character
-import Struct.Tile
-import Struct.TurnResult
import Struct.Weapon
--------------------------------------------------------------------------------
@@ -16,13 +13,10 @@ import Struct.Weapon
type Type =
Okay
+ | Disconnected
| AddArmor Struct.Armor.Type
| AddWeapon Struct.Weapon.Type
| AddCharacter (Struct.Character.Type, Int, Int, Int)
- | AddTile Struct.Tile.Type
- | SetMap Struct.Map.Type
- | TurnResults (List Struct.TurnResult.Type)
- | SetTimeline (List Struct.TurnResult.Type)
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
diff --git a/src/roster-editor/src/Struct/Statistics.elm b/src/roster-editor/src/Struct/Statistics.elm
new file mode 100644
index 0000000..f676648
--- /dev/null
+++ b/src/roster-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/roster-editor/src/Struct/UI.elm b/src/roster-editor/src/Struct/UI.elm
new file mode 100644
index 0000000..2831bc0
--- /dev/null
+++ b/src/roster-editor/src/Struct/UI.elm
@@ -0,0 +1,52 @@
+module Struct.UI exposing
+ (
+ Type,
+ Tab(..),
+ default,
+ -- Tab
+ get_displayed_tab,
+ set_displayed_tab,
+ reset_displayed_tab
+ )
+
+-- Elm -------------------------------------------------------------------------
+
+-- Roster Editor ---------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- TYPES -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+type Tab =
+ CharacterSelectionTab
+ | PortraitSelectionTab
+-- | AccessorySelectionTab
+ | WeaponSelectionTab
+ | GlyphManagementTab
+
+type alias Type =
+ {
+ displayed_tab : Tab
+ }
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+default : Type
+default =
+ {
+ displayed_tab = CharacterSelectionTab,
+ }
+
+-- Tab -------------------------------------------------------------------------
+get_displayed_tab : Type -> Tab
+get_displayed_tab ui = ui.displayed_tab
+
+set_displayed_tab : Tab -> Type -> Type
+set_displayed_tab tab ui = {ui | displayed_tab = tab}
+
+reset_displayed_tab : Type -> Type
+reset_displayed_tab ui = {ui | displayed_tab = CharacterSelectionTab}
diff --git a/src/roster-editor/src/Struct/Weapon.elm b/src/roster-editor/src/Struct/Weapon.elm
new file mode 100644
index 0000000..2035fe4
--- /dev/null
+++ b/src/roster-editor/src/Struct/Weapon.elm
@@ -0,0 +1,99 @@
+module Struct.Weapon exposing
+ (
+ Type,
+ Ref,
+ new,
+ get_id,
+ get_name,
+ get_attack_range,
+ get_defense_range,
+ get_omnimods,
+ get_damage_sum,
+ decoder,
+ none
+ )
+
+-- Elm -------------------------------------------------------------------------
+import Json.Decode
+import Json.Decode.Pipeline
+
+-- Map -------------------------------------------------------------------
+import Struct.Omnimods
+
+--------------------------------------------------------------------------------
+-- TYPES -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+type alias PartiallyDecoded =
+ {
+ id : Int,
+ nam : String,
+ rmi : Int,
+ rma : Int,
+ omni : String
+ }
+
+type alias Type =
+ {
+ id : Int,
+ name : String,
+ def_range : Int,
+ atk_range : Int,
+ omnimods : Struct.Omnimods.Type,
+ damage_sum : Int
+ }
+
+type alias Ref = Int
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+new : Int -> String -> Int -> Int -> Struct.Omnimods.Type -> Type
+new id name range_min range_max omnimods =
+ {
+ id = id,
+ name = name,
+ def_range = range_min,
+ atk_range = range_max,
+ omnimods = omnimods,
+ damage_sum = (Struct.Omnimods.get_damage_sum omnimods)
+ }
+
+get_id : Type -> Int
+get_id wp = wp.id
+
+get_name : Type -> String
+get_name wp = wp.name
+
+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.Pipeline.decode
+ Type
+ |> (Json.Decode.Pipeline.required "id" Json.Decode.int)
+ |> (Json.Decode.Pipeline.required "nam" Json.Decode.string)
+ |> (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 = (new 0 "None" 0 0 (Struct.Omnimods.new [] [] [] []))
diff --git a/src/character/src/Struct/WeaponSet.elm b/src/roster-editor/src/Struct/WeaponSet.elm
index de96daf..de96daf 100644
--- a/src/character/src/Struct/WeaponSet.elm
+++ b/src/roster-editor/src/Struct/WeaponSet.elm
diff --git a/src/character/src/Update/DisplayCharacterInfo.elm b/src/roster-editor/src/Update/DisplayCharacterInfo.elm
index e482e2f..e482e2f 100644
--- a/src/character/src/Update/DisplayCharacterInfo.elm
+++ b/src/roster-editor/src/Update/DisplayCharacterInfo.elm
diff --git a/src/roster-editor/src/Update/GoToMainMenu.elm b/src/roster-editor/src/Update/GoToMainMenu.elm
new file mode 100644
index 0000000..f2ec989
--- /dev/null
+++ b/src/roster-editor/src/Update/GoToMainMenu.elm
@@ -0,0 +1,24 @@
+module Update.GoToMainMenu exposing (apply_to)
+-- Elm -------------------------------------------------------------------------
+
+-- Battle ----------------------------------------------------------------------
+import Action.Ports
+
+import Constants.IO
+
+import Struct.Model
+import Struct.Event
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+apply_to : Struct.Model.Type -> (Struct.Model.Type, (Cmd Struct.Event.Type))
+apply_to model =
+ (
+ model,
+ (Action.Ports.go_to (Constants.IO.base_url ++"/main-menu/"))
+ )
diff --git a/src/roster-editor/src/Update/HandleServerReply.elm b/src/roster-editor/src/Update/HandleServerReply.elm
new file mode 100644
index 0000000..22261da
--- /dev/null
+++ b/src/roster-editor/src/Update/HandleServerReply.elm
@@ -0,0 +1,174 @@
+module Update.HandleServerReply exposing (apply_to)
+
+-- Elm -------------------------------------------------------------------------
+import Array
+
+import Delay
+
+import Dict
+
+import Http
+
+import Time
+
+-- Shared ----------------------------------------------------------------------
+import Action.Ports
+
+import Struct.Flags
+
+-- Roster Editor ---------------------------------------------------------------
+import Constants.IO
+
+import Struct.Armor
+import Struct.Character
+import Struct.Error
+import Struct.Event
+import Struct.Model
+import Struct.ServerReply
+import Struct.UI
+import Struct.Weapon
+
+--------------------------------------------------------------------------------
+-- TYPES -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+weapon_getter : Struct.Model.Type -> Struct.Weapon.Ref -> Struct.Weapon.Type
+weapon_getter model ref =
+ case (Dict.get ref model.weapons) of
+ (Just w) -> w
+ Nothing -> Struct.Weapon.none
+
+armor_getter : Struct.Model.Type -> Struct.Armor.Ref -> Struct.Armor.Type
+armor_getter model ref =
+ case (Dict.get ref model.armors) of
+ (Just w) -> w
+ Nothing -> Struct.Armor.none
+
+-----------
+
+disconnected : (
+ (Struct.Model.Type, (List (Cmd Struct.Event.Type))) ->
+ (Struct.Model.Type, (List (Cmd Struct.Event.Type)))
+ )
+disconnected current_state =
+ let (model, cmds) = current_state in
+ (
+ model,
+ [
+ (Action.Ports.go_to
+ (
+ Constants.IO.base_url
+ ++ "/login/?action=disconnect&goto="
+ ++
+ (Http.encodeUri
+ (
+ "/roster-editor/?"
+ ++ (Struct.Flags.get_params_as_url model.flags)
+ )
+ )
+ )
+ )
+ ]
+ )
+
+add_armor : (
+ Struct.Armor.Type ->
+ (Struct.Model.Type, (List (Cmd Struct.Event.Type))) ->
+ (Struct.Model.Type, (List (Cmd Struct.Event.Type)))
+ )
+add_armor ar current_state =
+ let (model, cmds) = current_state in
+ ((Struct.Model.add_armor ar model), cmds)
+
+add_weapon : (
+ Struct.Weapon.Type ->
+ (Struct.Model.Type, (List (Cmd Struct.Event.Type))) ->
+ (Struct.Model.Type, (List (Cmd Struct.Event.Type)))
+ )
+add_weapon wp current_state =
+ let (model, cmds) = current_state in
+ ((Struct.Model.add_weapon wp model), cmds)
+
+add_character : (
+ (Struct.Character.Type, Int, Int, Int) ->
+ (Struct.Model.Type, (List (Cmd Struct.Event.Type))) ->
+ (Struct.Model.Type, (List (Cmd Struct.Event.Type)))
+ )
+add_character char_and_refs current_state =
+ let
+ (model, cmds) = current_state
+ (char, awp_ref, swp_ref, ar_ref) = char_and_refs
+ awp = (weapon_getter model awp_ref)
+ swp = (weapon_getter model swp_ref)
+ ar = (armor_getter model ar_ref)
+ in
+ (
+ (Struct.Model.add_character
+ (Struct.Character.fill_missing_equipment_and_omnimods
+ (Struct.Model.tile_omnimods_fun model)
+ awp
+ swp
+ ar
+ char
+ )
+ model
+ ),
+ cmds
+ )
+
+apply_command : (
+ Struct.ServerReply.Type ->
+ (Struct.Model.Type, (List (Cmd Struct.Event.Type))) ->
+ (Struct.Model.Type, (List (Cmd Struct.Event.Type)))
+ )
+apply_command command current_state =
+ case command of
+ Struct.ServerReply.Disconnected -> (disconnected current_state)
+
+ (Struct.ServerReply.AddWeapon wp) ->
+ (add_weapon wp current_state)
+
+ (Struct.ServerReply.AddArmor ar) ->
+ (add_armor ar current_state)
+
+ (Struct.ServerReply.AddCharacter char) ->
+ (add_character char current_state)
+
+ Struct.ServerReply.Okay -> current_state
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+apply_to : (
+ Struct.Model.Type ->
+ (Result Http.Error (List Struct.ServerReply.Type)) ->
+ (Struct.Model.Type, (Cmd Struct.Event.Type))
+ )
+apply_to model query_result =
+ case query_result of
+ (Result.Err error) ->
+ (
+ (Struct.Model.invalidate
+ (Struct.Error.new Struct.Error.Networking (toString error))
+ model
+ ),
+ Cmd.none
+ )
+
+ (Result.Ok commands) ->
+ let
+ (new_model, elm_commands) =
+ (List.foldl (apply_command) (model, [Cmd.none]) commands)
+ in
+ (
+ new_model,
+ (
+ case elm_commands of
+ [] -> Cmd.none
+ [cmd] -> cmd
+ _ -> (Cmd.batch elm_commands)
+ )
+ )
diff --git a/src/character/src/Update/SelectCharacter.elm b/src/roster-editor/src/Update/SelectCharacter.elm
index 1137435..169046c 100644
--- a/src/character/src/Update/SelectCharacter.elm
+++ b/src/roster-editor/src/Update/SelectCharacter.elm
@@ -41,8 +41,8 @@ get_character_navigator model char =
(Struct.Statistics.get_movement_points
(Struct.Character.get_statistics char)
)
- (Struct.Weapon.get_attack_range weapon)
(Struct.Weapon.get_defense_range weapon)
+ (Struct.Weapon.get_attack_range weapon)
(Struct.Map.get_movement_cost_function
model.map
(Struct.Character.get_location char)
diff --git a/src/character/src/Update/SelectTab.elm b/src/roster-editor/src/Update/SelectTab.elm
index d15a463..d15a463 100644
--- a/src/character/src/Update/SelectTab.elm
+++ b/src/roster-editor/src/Update/SelectTab.elm
diff --git a/src/character/src/Update/SendLoadRosterRequest.elm b/src/roster-editor/src/Update/SendLoadRosterRequest.elm
index b7b5f11..2bbe9da 100644
--- a/src/character/src/Update/SendLoadRosterRequest.elm
+++ b/src/roster-editor/src/Update/SendLoadRosterRequest.elm
@@ -1,7 +1,7 @@
module Update.SendLoadRosterRequest exposing (apply_to)
-- Elm -------------------------------------------------------------------------
--- Map -------------------------------------------------------------------
+-- Roster Editor ---------------------------------------------------------------
import Comm.LoadRoster
import Struct.Event
@@ -14,13 +14,10 @@ import Struct.Model
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-apply_to : (
- Struct.Model.Type ->
- (Struct.Model.Type, (Cmd Struct.Event.Type))
- )
+apply_to : Struct.Model.Type -> (Struct.Model.Type, (Cmd Struct.Event.Type))
apply_to model =
(
- (Struct.Model.reset model),
+ model,
(case (Comm.LoadRoster.try model) of
(Just cmd) -> cmd
Nothing -> Cmd.none
diff --git a/src/character/src/Update/SetRequestedHelp.elm b/src/roster-editor/src/Update/SetRequestedHelp.elm
index dfc58db..dfc58db 100644
--- a/src/character/src/Update/SetRequestedHelp.elm
+++ b/src/roster-editor/src/Update/SetRequestedHelp.elm
diff --git a/src/character/src/View/Character.elm b/src/roster-editor/src/View/Character.elm
index d33feb1..d33feb1 100644
--- a/src/character/src/View/Character.elm
+++ b/src/roster-editor/src/View/Character.elm
diff --git a/src/roster-editor/src/View/CharacterIcon.elm b/src/roster-editor/src/View/CharacterIcon.elm
new file mode 100644
index 0000000..aaf7cb2
--- /dev/null
+++ b/src/roster-editor/src/View/CharacterIcon.elm
@@ -0,0 +1,218 @@
+module View.Map.Character exposing (get_html)
+
+-- Elm -------------------------------------------------------------------------
+import Html
+import Html.Attributes
+import Html.Events
+
+-- Map ------------------------------------------------------------------
+import Constants.UI
+
+import Util.Html
+
+import Struct.Character
+import Struct.CharacterTurn
+import Struct.Event
+import Struct.Model
+import Struct.TurnResult
+import Struct.TurnResultAnimator
+import Struct.UI
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_animation_class : (
+ Struct.Model.Type ->
+ Struct.Character.Type ->
+ (Html.Attribute Struct.Event.Type)
+ )
+get_animation_class model char =
+ case model.animator of
+ Nothing -> (Html.Attributes.class "")
+ (Just animator) ->
+ case (Struct.TurnResultAnimator.get_current_animation animator) of
+ (Struct.TurnResultAnimator.Focus char_index) ->
+ if ((Struct.Character.get_index char) /= char_index)
+ then
+ (Html.Attributes.class "")
+ else
+ (Html.Attributes.class "battle-character-selected")
+
+ (Struct.TurnResultAnimator.TurnResult current_action) ->
+ if
+ (
+ (Struct.TurnResult.get_actor_index current_action)
+ /=
+ (Struct.Character.get_index char)
+ )
+ then
+ (Html.Attributes.class "")
+ else
+ case current_action of
+ (Struct.TurnResult.Moved _) ->
+ (Html.Attributes.class
+ "battle-animated-character-icon"
+ )
+
+ _ -> (Html.Attributes.class "")
+ _ -> (Html.Attributes.class "")
+
+get_activation_level_class : (
+ Struct.Character.Type ->
+ (Html.Attribute Struct.Event.Type)
+ )
+get_activation_level_class char =
+ if (Struct.Character.is_enabled char)
+ then
+ (Html.Attributes.class "battle-character-icon-enabled")
+ else
+ (Html.Attributes.class "battle-character-icon-disabled")
+
+get_alliance_class : (
+ Struct.Model.Type ->
+ Struct.Character.Type ->
+ (Html.Attribute Struct.Event.Type)
+ )
+get_alliance_class model char =
+ if ((Struct.Character.get_player_ix char) == model.player_ix)
+ then
+ (Html.Attributes.class "battle-character-ally")
+ else
+ (Html.Attributes.class "battle-character-enemy")
+
+get_position_style : (
+ Struct.Character.Type ->
+ (Html.Attribute Struct.Event.Type)
+ )
+get_position_style char =
+ let char_loc = (Struct.Character.get_location char) in
+ (Html.Attributes.style
+ [
+ ("top", ((toString (char_loc.y * Constants.UI.tile_size)) ++ "px")),
+ ("left", ((toString (char_loc.x * Constants.UI.tile_size)) ++ "px"))
+ ]
+ )
+
+get_focus_class : (
+ Struct.Model.Type ->
+ Struct.Character.Type ->
+ (Html.Attribute Struct.Event.Type)
+ )
+get_focus_class model char =
+ if
+ (
+ (Struct.UI.get_previous_action model.ui)
+ ==
+ (Just (Struct.UI.SelectedCharacter (Struct.Character.get_index char)))
+ )
+ then
+ (Html.Attributes.class "battle-character-selected")
+ else
+ if
+ (
+ (Struct.CharacterTurn.try_getting_target model.char_turn)
+ ==
+ (Just (Struct.Character.get_index char))
+ )
+ then
+ (Html.Attributes.class "battle-character-targeted")
+ else
+ (Html.Attributes.class "")
+
+get_body_html : Struct.Character.Type -> (Html.Html Struct.Event.Type)
+get_body_html char =
+ (Html.div
+ [
+ (Html.Attributes.class "battle-character-icon-body"),
+ (Html.Attributes.class
+ (
+ "asset-character-team-body-"
+ ++ (toString (Struct.Character.get_player_ix char))
+ )
+ )
+ ]
+ [
+ ]
+ )
+
+get_head_html : Struct.Character.Type -> (Html.Html Struct.Event.Type)
+get_head_html char =
+ (Html.div
+ [
+ (Html.Attributes.class "battle-character-icon-head"),
+ (Html.Attributes.class
+ ("asset-character-icon-" ++ (Struct.Character.get_icon_id char))
+ )
+ ]
+ [
+ ]
+ )
+
+get_banner_html : Struct.Character.Type -> (Html.Html Struct.Event.Type)
+get_banner_html char =
+ case (Struct.Character.get_rank char) of
+ Struct.Character.Commander ->
+ (Html.div
+ [
+ (Html.Attributes.class "battle-character-icon-banner"),
+ (Html.Attributes.class "asset-character-icon-commander-banner")
+ ]
+ [
+ ]
+ )
+
+ Struct.Character.Target ->
+ (Html.div
+ [
+ (Html.Attributes.class "battle-character-icon-banner"),
+ (Html.Attributes.class "asset-character-icon-target-banner")
+ ]
+ [
+ ]
+ )
+
+ _ -> (Util.Html.nothing)
+
+get_actual_html : (
+ Struct.Model.Type ->
+ Struct.Character.Type ->
+ (Html.Html Struct.Event.Type)
+ )
+get_actual_html model char =
+ (Html.div
+ [
+ (Html.Attributes.class "battle-tiled"),
+ (Html.Attributes.class "battle-character-icon"),
+ (get_animation_class model char),
+ (get_activation_level_class char),
+ (get_alliance_class model char),
+ (get_position_style char),
+ (get_focus_class model char),
+ (Html.Attributes.class "clickable"),
+ (Html.Events.onClick
+ (Struct.Event.CharacterSelected
+ (Struct.Character.get_index char)
+ )
+ )
+ ]
+ [
+ (get_body_html char),
+ (get_head_html char),
+ (get_banner_html char)
+ ]
+ )
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_html : (
+ Struct.Model.Type ->
+ Struct.Character.Type ->
+ (Html.Html Struct.Event.Type)
+ )
+get_html model char =
+ if (Struct.Character.is_alive char)
+ then
+ (get_actual_html model char)
+ else
+ (Util.Html.nothing)
diff --git a/src/character/src/View/Controlled.elm b/src/roster-editor/src/View/Controlled.elm
index e0e20bf..d0c33a5 100644
--- a/src/character/src/View/Controlled.elm
+++ b/src/roster-editor/src/View/Controlled.elm
@@ -47,6 +47,13 @@ abort_button =
[ (Html.text "Abort") ]
)
+undo_button : (Html.Html Struct.Event.Type)
+undo_button =
+ (Html.button
+ [ (Html.Events.onClick Struct.Event.UndoActionRequest) ]
+ [ (Html.text "Undo") ]
+ )
+
end_turn_button : String -> (Html.Html Struct.Event.Type)
end_turn_button suffix =
(Html.button
@@ -57,11 +64,19 @@ end_turn_button suffix =
[ (Html.text ("End Turn" ++ suffix)) ]
)
-inventory_button : (Html.Html Struct.Event.Type)
-inventory_button =
+inventory_button : Bool -> (Html.Html Struct.Event.Type)
+inventory_button go_prefix =
(Html.button
[ (Html.Events.onClick Struct.Event.WeaponSwitchRequest) ]
- [ (Html.text "Switch Weapon") ]
+ [
+ (Html.text
+ (
+ if (go_prefix)
+ then ("Go & Switch Weapon")
+ else ("Switch Weapon")
+ )
+ )
+ ]
)
get_available_actions : (
@@ -73,20 +88,30 @@ get_available_actions char_turn =
Struct.CharacterTurn.SelectedCharacter ->
[
(attack_button char_turn),
- (inventory_button),
+ (inventory_button (has_a_path char_turn)),
(end_turn_button " Doing Nothing"),
(abort_button)
]
Struct.CharacterTurn.MovedCharacter ->
[
- (end_turn_button " Without Attacking"),
+ (inventory_button False),
+ (end_turn_button " by Moving"),
+ (undo_button),
(abort_button)
]
Struct.CharacterTurn.ChoseTarget ->
[
- (end_turn_button " By Attacking"),
+ (end_turn_button " by Attacking"),
+ (undo_button),
+ (abort_button)
+ ]
+
+ Struct.CharacterTurn.SwitchedWeapons ->
+ [
+ (end_turn_button " by Switching Weapons"),
+ (undo_button),
(abort_button)
]
diff --git a/src/character/src/View/Controlled/CharacterCard.elm b/src/roster-editor/src/View/Controlled/CharacterCard.elm
index 0e29502..ac56cbb 100644
--- a/src/character/src/View/Controlled/CharacterCard.elm
+++ b/src/roster-editor/src/View/Controlled/CharacterCard.elm
@@ -6,18 +6,20 @@ module View.Controlled.CharacterCard exposing
)
-- Elm -------------------------------------------------------------------------
+import List
+
import Html
import Html.Attributes
import Html.Events
--- Map -------------------------------------------------------------------
+-- Battle ----------------------------------------------------------------------
import Struct.Armor
-import Struct.Attributes
import Struct.Character
import Struct.CharacterTurn
import Struct.Event
import Struct.HelpRequest
import Struct.Navigator
+import Struct.Omnimods
import Struct.Statistics
import Struct.Weapon
import Struct.WeaponSet
@@ -192,20 +194,19 @@ get_movement_bar char_turn char =
Nothing ->
(get_inactive_movement_bar char)
-get_weapon_details : (
- Struct.Statistics.Type ->
+get_weapon_field_header : (
+ Float ->
Struct.Weapon.Type ->
(Html.Html Struct.Event.Type)
)
-get_weapon_details stats weapon =
+get_weapon_field_header damage_multiplier weapon =
(Html.div
[
- (Html.Attributes.class "battle-character-card-weapon")
+ (Html.Attributes.class "battle-character-card-header")
]
[
(Html.div
[
- (Html.Attributes.class "battle-character-card-weapon-name")
]
[
(Html.text (Struct.Weapon.get_name weapon))
@@ -213,27 +214,25 @@ get_weapon_details stats weapon =
),
(Html.div
[
- (Html.Attributes.class "battle-character-card-weapon-name")
]
[
(Html.text
(
- "["
- ++ (toString (Struct.Statistics.get_damage_min stats))
- ++ ", "
- ++ (toString (Struct.Statistics.get_damage_max stats))
- ++ "] "
- ++
- (case (Struct.Weapon.get_damage_type weapon) of
- Struct.Weapon.Slash -> "slashing "
- Struct.Weapon.Pierce -> "piercing "
- Struct.Weapon.Blunt -> "bludgeoning "
- )
+ "~"
++
- (case (Struct.Weapon.get_range_type weapon) of
- Struct.Weapon.Ranged -> "ranged"
- Struct.Weapon.Melee -> "melee"
+ (toString
+ (ceiling
+ (
+ (toFloat (Struct.Weapon.get_damage_sum weapon))
+ * damage_multiplier
+ )
+ )
)
+ ++ " dmg @ ["
+ ++ (toString (Struct.Weapon.get_defense_range weapon))
+ ++ ", "
+ ++ (toString (Struct.Weapon.get_attack_range weapon))
+ ++ "]"
)
)
]
@@ -241,53 +240,88 @@ get_weapon_details stats weapon =
]
)
-get_weapon_summary : (
+get_mod_html : (String, Int) -> (Html.Html Struct.Event.Type)
+get_mod_html mod =
+ let
+ (category, value) = mod
+ in
+ (Html.div
+ [
+ (Html.Attributes.class "battle-info-card-mod")
+ ]
+ [
+ (Html.text
+ (category ++ ": " ++ (toString value))
+ )
+ ]
+ )
+
+get_multiplied_mod_html : Float -> (String, Int) -> (Html.Html Struct.Event.Type)
+get_multiplied_mod_html multiplier mod =
+ let
+ (category, value) = mod
+ in
+ (Html.div
+ [
+ (Html.Attributes.class "battle-character-card-mod")
+ ]
+ [
+ (Html.text
+ (
+ category
+ ++ ": "
+ ++ (toString (ceiling ((toFloat value) * multiplier)))
+ )
+ )
+ ]
+ )
+
+get_weapon_details : (
+ Struct.Omnimods.Type ->
+ Float ->
Struct.Weapon.Type ->
(Html.Html Struct.Event.Type)
)
-get_weapon_summary weapon =
+get_weapon_details omnimods damage_multiplier weapon =
(Html.div
[
- (Html.Attributes.class "battle-character-card-weapon-summary")
+ (Html.Attributes.class "battle-character-card-weapon")
]
[
+ (get_weapon_field_header damage_multiplier weapon),
(Html.div
[
- (Html.Attributes.class "battle-character-card-weapon-name")
- ]
- [
- (Html.text (Struct.Weapon.get_name weapon))
- ]
- ),
- (Html.div
- [
- (Html.Attributes.class "battle-character-card-weapon-name")
- ]
- [
- (Html.text
- (
- (case (Struct.Weapon.get_damage_type weapon) of
- Struct.Weapon.Slash -> "Slashing "
- Struct.Weapon.Pierce -> "Piercing "
- Struct.Weapon.Blunt -> "Bludgeoning "
- )
- ++
- (case (Struct.Weapon.get_range_type weapon) of
- Struct.Weapon.Ranged -> "ranged"
- Struct.Weapon.Melee -> "melee"
- )
- )
- )
+ (Html.Attributes.class "battle-info-card-omnimods-listing")
]
+ (List.map
+ (get_multiplied_mod_html damage_multiplier)
+ (Struct.Omnimods.get_attack_mods omnimods)
+ )
)
]
)
+get_weapon_summary : (
+ Float ->
+ Struct.Weapon.Type ->
+ (Html.Html Struct.Event.Type)
+ )
+get_weapon_summary damage_multiplier weapon =
+ (Html.div
+ [
+ (Html.Attributes.class "battle-character-card-weapon-summary")
+ ]
+ [
+ (get_weapon_field_header damage_multiplier weapon)
+ ]
+ )
+
get_armor_details : (
+ Struct.Omnimods.Type ->
Struct.Armor.Type ->
(Html.Html Struct.Event.Type)
)
-get_armor_details armor =
+get_armor_details omnimods armor =
(Html.div
[
(Html.Attributes.class "battle-character-card-armor")
@@ -303,25 +337,12 @@ get_armor_details armor =
),
(Html.div
[
- (Html.Attributes.class "battle-character-card-armor-stats")
- ]
- [
- (stat_name "Slash"),
- (stat_val
- (Struct.Armor.get_resistance_to Struct.Weapon.Slash armor)
- False
- ),
- (stat_name "Pierc."),
- (stat_val
- (Struct.Armor.get_resistance_to Struct.Weapon.Pierce armor)
- False
- ),
- (stat_name "Blund."),
- (stat_val
- (Struct.Armor.get_resistance_to Struct.Weapon.Blunt armor)
- False
- )
+ (Html.Attributes.class "battle-info-card-omnimods-listing")
]
+ (List.map
+ (get_mod_html)
+ (Struct.Omnimods.get_defense_mods omnimods)
+ )
)
]
)
@@ -360,123 +381,28 @@ stat_val val perc =
]
)
-att_dual_val : Int -> Int -> (Html.Html Struct.Event.Type)
-att_dual_val base active =
- let
- diff = (active - base)
- in
- (Html.div
- [
- (Html.Attributes.class "battle-character-card-att-dual-val")
- ]
- [
- (Html.text
- (
- (toString base)
- ++ " ("
- ++
- (
- if (diff > 0)
- then
- ("+" ++ (toString diff))
- else
- if (diff == 0)
- then
- "~"
- else
- (toString diff)
- )
- ++ ")"
- )
- )
- ]
- )
-
get_relevant_stats : (
- Struct.Character.Type ->
- Struct.Weapon.Type ->
+ Struct.Statistics.Type ->
(Html.Html Struct.Event.Type)
)
-get_relevant_stats char weapon =
- let
- stats = (Struct.Character.get_statistics char)
- in
- (Html.div
- [
- (Html.Attributes.class "battle-character-card-stats")
- ]
- [
- (stat_name "Dodge"),
- (stat_val (Struct.Statistics.get_dodges stats) True),
- (stat_name "Parry"),
- (stat_val
- (case (Struct.Weapon.get_range_type weapon) of
- Struct.Weapon.Ranged -> 0
- Struct.Weapon.Melee -> (Struct.Statistics.get_parries stats)
- )
- True
- ),
- (stat_name "Accu."),
- (stat_val (Struct.Statistics.get_accuracy stats) False),
- (stat_name "2xHit"),
- (stat_val (Struct.Statistics.get_double_hits stats) True),
- (stat_name "Crit."),
- (stat_val (Struct.Statistics.get_critical_hits stats) True)
- ]
- )
-
-get_attributes : (
- Struct.Character.Type ->
- Struct.Weapon.Type ->
- Struct.Armor.Type ->
- (Html.Html Struct.Event.Type)
+get_relevant_stats stats =
+ (Html.div
+ [
+ (Html.Attributes.class "battle-character-card-stats")
+ ]
+ [
+ (stat_name "Dodge"),
+ (stat_val (Struct.Statistics.get_dodges stats) True),
+ (stat_name "Parry"),
+ (stat_val (Struct.Statistics.get_parries stats) True),
+ (stat_name "Accu."),
+ (stat_val (Struct.Statistics.get_accuracy stats) False),
+ (stat_name "2xHit"),
+ (stat_val (Struct.Statistics.get_double_hits stats) True),
+ (stat_name "Crit."),
+ (stat_val (Struct.Statistics.get_critical_hits stats) True)
+ ]
)
-get_attributes char weapon armor =
- let
- base_atts = (Struct.Character.get_attributes char)
- active_atts =
- (Struct.Armor.apply_to_attributes
- armor
- (Struct.Weapon.apply_to_attributes weapon base_atts)
- )
- in
- (Html.div
- [
- (Html.Attributes.class "battle-character-card-stats")
- ]
- [
- (stat_name "Con"),
- (att_dual_val
- (Struct.Attributes.get_constitution base_atts)
- (Struct.Attributes.get_constitution active_atts)
- ),
- (stat_name "Dex"),
- (att_dual_val
- (Struct.Attributes.get_dexterity base_atts)
- (Struct.Attributes.get_dexterity active_atts)
- ),
- (stat_name "Int"),
- (att_dual_val
- (Struct.Attributes.get_intelligence base_atts)
- (Struct.Attributes.get_intelligence active_atts)
- ),
- (stat_name "Min"),
- (att_dual_val
- (Struct.Attributes.get_mind base_atts)
- (Struct.Attributes.get_mind active_atts)
- ),
- (stat_name "Spe"),
- (att_dual_val
- (Struct.Attributes.get_speed base_atts)
- (Struct.Attributes.get_speed active_atts)
- ),
- (stat_name "Str"),
- (att_dual_val
- (Struct.Attributes.get_strength base_atts)
- (Struct.Attributes.get_strength active_atts)
- )
- ]
- )
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
@@ -529,7 +455,9 @@ get_summary_html char_turn player_ix char =
weapon_set = (Struct.Character.get_weapons char)
main_weapon = (Struct.WeaponSet.get_active_weapon weapon_set)
char_statistics = (Struct.Character.get_statistics char)
+ damage_modifier = (Struct.Statistics.get_damage_modifier char_statistics)
secondary_weapon = (Struct.WeaponSet.get_secondary_weapon weapon_set)
+ omnimods = (Struct.Character.get_current_omnimods char)
in
(Html.div
[
@@ -556,10 +484,10 @@ get_summary_html char_turn player_ix char =
(get_statuses char)
]
),
- (get_weapon_details char_statistics main_weapon),
- (get_armor_details (Struct.Character.get_armor char)),
- (get_relevant_stats char main_weapon),
- (get_weapon_summary secondary_weapon)
+ (get_weapon_details omnimods damage_modifier main_weapon),
+ (get_armor_details omnimods (Struct.Character.get_armor char)),
+ (get_relevant_stats char_statistics),
+ (get_weapon_summary damage_modifier secondary_weapon)
]
)
@@ -573,8 +501,10 @@ get_full_html player_ix char =
weapon_set = (Struct.Character.get_weapons char)
main_weapon = (Struct.WeaponSet.get_active_weapon weapon_set)
char_statistics = (Struct.Character.get_statistics char)
+ damage_modifier = (Struct.Statistics.get_damage_modifier char_statistics)
secondary_weapon = (Struct.WeaponSet.get_secondary_weapon weapon_set)
armor = (Struct.Character.get_armor char)
+ omnimods = (Struct.Character.get_current_omnimods char)
in
(Html.div
[
@@ -602,10 +532,9 @@ get_full_html player_ix char =
(get_statuses char)
]
),
- (get_weapon_details char_statistics main_weapon),
- (get_armor_details armor),
- (get_relevant_stats char main_weapon),
- (get_weapon_summary secondary_weapon),
- (get_attributes char main_weapon armor)
+ (get_weapon_details omnimods damage_modifier main_weapon),
+ (get_armor_details omnimods armor),
+ (get_relevant_stats char_statistics),
+ (get_weapon_summary damage_modifier secondary_weapon)
]
)
diff --git a/src/character/src/View/Controlled/ManualControls.elm b/src/roster-editor/src/View/Controlled/ManualControls.elm
index 1dceafb..1dceafb 100644
--- a/src/character/src/View/Controlled/ManualControls.elm
+++ b/src/roster-editor/src/View/Controlled/ManualControls.elm
diff --git a/src/character/src/View/Controlled/Targets.elm b/src/roster-editor/src/View/Controlled/Targets.elm
index eee5a54..eee5a54 100644
--- a/src/character/src/View/Controlled/Targets.elm
+++ b/src/roster-editor/src/View/Controlled/Targets.elm
diff --git a/src/roster-editor/src/View/CurrentTab.elm b/src/roster-editor/src/View/CurrentTab.elm
new file mode 100644
index 0000000..8a062a9
--- /dev/null
+++ b/src/roster-editor/src/View/CurrentTab.elm
@@ -0,0 +1,40 @@
+module View.CurrentTab exposing (get_html)
+
+-- Elm -------------------------------------------------------------------------
+import Html
+
+-- Roster Editor ---------------------------------------------------------------
+import Struct.Event
+import Struct.Model
+import Struct.UI
+
+import View.CharacterSelection
+import View.PortraitSelection
+import View.WeaponSelection
+import View.ArmorSelection
+import View.GlyphManagement
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
+get_html model =
+ case (Struct.UI.get_displayed_tab model.ui) of
+ Struct.UI.CharacterSelectionTab ->
+ (View.CharacterSelection.get_html model)
+
+ Struct.UI.PortraitSelectionTab ->
+ (View.PortraitSelection.get_html model)
+
+ Struct.UI.WeaponSelectionTab ->
+ (View.WeaponSelection.get_html model)
+
+ Struct.UI.ArmorSelectionTab ->
+ (View.ArmorSelection.get_html model)
+
+ Struct.UI.GlyphManagementTab ->
+ (View.GlyphManagement.get_html model)
diff --git a/src/character/src/View/Gauge.elm b/src/roster-editor/src/View/Gauge.elm
index cf89f3a..cf89f3a 100644
--- a/src/character/src/View/Gauge.elm
+++ b/src/roster-editor/src/View/Gauge.elm
diff --git a/src/character/src/View/MainMenu.elm b/src/roster-editor/src/View/MainMenu.elm
index 9f3099b..96bf539 100644
--- a/src/character/src/View/MainMenu.elm
+++ b/src/roster-editor/src/View/MainMenu.elm
@@ -12,16 +12,20 @@ import Struct.UI
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_menu_button_html : (
- Struct.UI.Tab ->
- (Html.Html Struct.Event.Type)
- )
+get_menu_button_html : Struct.UI.Tab -> (Html.Html Struct.Event.Type)
get_menu_button_html tab =
(Html.button
[ (Html.Events.onClick (Struct.Event.TabSelected tab)) ]
[ (Html.text (Struct.UI.to_string tab)) ]
)
+get_main_menu_button_html : (Html.Html Struct.Event.Type)
+get_main_menu_button_html =
+ (Html.button
+ [ (Html.Events.onClick Struct.Event.GoToMainMenu) ]
+ [ (Html.text "Main Menu") ]
+ )
+
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
@@ -31,8 +35,12 @@ get_html =
[
(Html.Attributes.class "battle-main-menu")
]
- (List.map
- (get_menu_button_html)
- (Struct.UI.get_all_tabs)
+ (
+ (get_main_menu_button_html)
+ ::
+ (List.map
+ (get_menu_button_html)
+ (Struct.UI.get_all_tabs)
+ )
)
)
diff --git a/src/character/src/View/MessageBoard.elm b/src/roster-editor/src/View/MessageBoard.elm
index 736f938..736f938 100644
--- a/src/character/src/View/MessageBoard.elm
+++ b/src/roster-editor/src/View/MessageBoard.elm
diff --git a/src/character/src/View/MessageBoard/Animator.elm b/src/roster-editor/src/View/MessageBoard/Animator.elm
index 49bb83a..49bb83a 100644
--- a/src/character/src/View/MessageBoard/Animator.elm
+++ b/src/roster-editor/src/View/MessageBoard/Animator.elm
diff --git a/src/character/src/View/MessageBoard/Animator/Attack.elm b/src/roster-editor/src/View/MessageBoard/Animator/Attack.elm
index 437a76d..437a76d 100644
--- a/src/character/src/View/MessageBoard/Animator/Attack.elm
+++ b/src/roster-editor/src/View/MessageBoard/Animator/Attack.elm
diff --git a/src/character/src/View/MessageBoard/Error.elm b/src/roster-editor/src/View/MessageBoard/Error.elm
index 797d89f..797d89f 100644
--- a/src/character/src/View/MessageBoard/Error.elm
+++ b/src/roster-editor/src/View/MessageBoard/Error.elm
diff --git a/src/character/src/View/MessageBoard/Help.elm b/src/roster-editor/src/View/MessageBoard/Help.elm
index 6c20bbc..6c20bbc 100644
--- a/src/character/src/View/MessageBoard/Help.elm
+++ b/src/roster-editor/src/View/MessageBoard/Help.elm
diff --git a/src/character/src/View/MessageBoard/Help/Guide.elm b/src/roster-editor/src/View/MessageBoard/Help/Guide.elm
index 0a41e91..7268c12 100644
--- a/src/character/src/View/MessageBoard/Help/Guide.elm
+++ b/src/roster-editor/src/View/MessageBoard/Help/Guide.elm
@@ -41,12 +41,13 @@ get_selected_character_html_contents =
get_moved_character_html_contents : (List (Html.Html Struct.Event.Type))
get_moved_character_html_contents =
[
- (get_header_html "Selecting a Target"),
+ (get_header_html "Selecting an Action"),
(Html.text
(
- "You can now choose a target in range. Dashed tiles indicate"
- ++ " where your character will not be able to defend themselves"
- ++ " against counter attacks."
+ """You can now choose an action for this character. Either attack
+ a target in range by clicking twice on it, or switch weapons by using the menu
+ on the left. Dashes indicate tiles this character will be unable to defend
+ from. Crossed shields indicate the equivalent for the current selection."""
)
)
]
@@ -54,12 +55,27 @@ get_moved_character_html_contents =
get_chose_target_html_contents : (List (Html.Html Struct.Event.Type))
get_chose_target_html_contents =
[
- (get_header_html "Finalizing the Character's Turn"),
+ (get_header_html "End the Turn by an Attack"),
(Html.text
(
- "If you are satisfied with your choices, you can end this"
- ++ " character's turn and see the results unfold. Otherwise, click"
- ++ " on the abort button to undo it all."
+ """A target for the attack has been selected. If you are satisfied
+with your choices, you can end this character's turn and see the results unfold.
+Otherwise, click on the "Undo" button to change the action, or the "Abort"
+button to start this turn over."""
+ )
+ )
+ ]
+
+get_switched_weapons_html_contents : (List (Html.Html Struct.Event.Type))
+get_switched_weapons_html_contents =
+ [
+ (get_header_html "End the Turn by Switching Weapons"),
+ (Html.text
+ (
+ """The character will switch weapons. If you are satisfied
+with your choices, you can end this character's turn and see the results unfold.
+Otherwise, click on the "Undo" button to change the action, or the "Abort"
+button to start this turn over."""
)
)
]
@@ -96,5 +112,8 @@ get_html_contents model =
Struct.CharacterTurn.ChoseTarget ->
(get_chose_target_html_contents)
+ Struct.CharacterTurn.SwitchedWeapons ->
+ (get_switched_weapons_html_contents)
+
_ ->
(get_default_html_contents)
diff --git a/src/character/src/View/MessageBoard/Help/Rank.elm b/src/roster-editor/src/View/MessageBoard/Help/Rank.elm
index 4a01e75..4a01e75 100644
--- a/src/character/src/View/MessageBoard/Help/Rank.elm
+++ b/src/roster-editor/src/View/MessageBoard/Help/Rank.elm
diff --git a/src/character/src/View/SubMenu.elm b/src/roster-editor/src/View/SubMenu.elm
index e661b9c..e661b9c 100644
--- a/src/character/src/View/SubMenu.elm
+++ b/src/roster-editor/src/View/SubMenu.elm
diff --git a/src/character/src/View/SubMenu/Characters.elm b/src/roster-editor/src/View/SubMenu/Characters.elm
index 396dbee..396dbee 100644
--- a/src/character/src/View/SubMenu/Characters.elm
+++ b/src/roster-editor/src/View/SubMenu/Characters.elm
diff --git a/src/character/src/View/SubMenu/Settings.elm b/src/roster-editor/src/View/SubMenu/Settings.elm
index e0ad4d7..e0ad4d7 100644
--- a/src/character/src/View/SubMenu/Settings.elm
+++ b/src/roster-editor/src/View/SubMenu/Settings.elm
diff --git a/src/character/src/View/SubMenu/Status.elm b/src/roster-editor/src/View/SubMenu/Status.elm
index 485704e..485704e 100644
--- a/src/character/src/View/SubMenu/Status.elm
+++ b/src/roster-editor/src/View/SubMenu/Status.elm
diff --git a/src/character/src/View/SubMenu/Status/CharacterInfo.elm b/src/roster-editor/src/View/SubMenu/Status/CharacterInfo.elm
index 814ce5f..814ce5f 100644
--- a/src/character/src/View/SubMenu/Status/CharacterInfo.elm
+++ b/src/roster-editor/src/View/SubMenu/Status/CharacterInfo.elm
diff --git a/src/character/src/View/SubMenu/Status/TileInfo.elm b/src/roster-editor/src/View/SubMenu/Status/TileInfo.elm
index 920b5ce..cace444 100644
--- a/src/character/src/View/SubMenu/Status/TileInfo.elm
+++ b/src/roster-editor/src/View/SubMenu/Status/TileInfo.elm
@@ -6,12 +6,13 @@ import Dict
import Html
import Html.Attributes
--- Struct.Map -------------------------------------------------------------------
+-- Battle ----------------------------------------------------------------------
import Constants.Movement
import Struct.Map
import Struct.Event
import Struct.Location
+import Struct.Omnimods
import Struct.Model
import Struct.Tile
@@ -58,7 +59,7 @@ get_name model tile =
]
)
-get_cost : (Struct.Tile.Instance -> (Html.Html Struct.Event.Type))
+get_cost : Struct.Tile.Instance -> (Html.Html Struct.Event.Type)
get_cost tile =
let
cost = (Struct.Tile.get_instance_cost tile)
@@ -79,7 +80,7 @@ get_cost tile =
]
)
-get_location : (Struct.Tile.Instance -> (Html.Html Struct.Event.Type))
+get_location : Struct.Tile.Instance -> (Html.Html Struct.Event.Type)
get_location tile =
let
tile_location = (Struct.Tile.get_location tile)
@@ -102,6 +103,48 @@ get_location tile =
]
)
+get_mod_html : (String, Int) -> (Html.Html Struct.Event.Type)
+get_mod_html mod =
+ let
+ (category, value) = mod
+ in
+ (Html.div
+ [
+ (Html.Attributes.class "battle-info-card-mod")
+ ]
+ [
+ (Html.text
+ (category ++ ": " ++ (toString value))
+ )
+ ]
+ )
+
+get_omnimods_listing : (List (String, Int)) -> (Html.Html Struct.Event.Type)
+get_omnimods_listing mod_list =
+ (Html.div
+ [
+ (Html.Attributes.class "battle-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 "battle-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))
+ ]
+ )
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
@@ -130,7 +173,8 @@ get_html model loc =
(get_location tile),
(get_cost tile)
]
- )
+ ),
+ (get_omnimods ((Struct.Model.tile_omnimods_fun model) loc))
]
)
diff --git a/src/character/src/View/SubMenu/Timeline.elm b/src/roster-editor/src/View/SubMenu/Timeline.elm
index 7fb1813..7fb1813 100644
--- a/src/character/src/View/SubMenu/Timeline.elm
+++ b/src/roster-editor/src/View/SubMenu/Timeline.elm
diff --git a/src/character/src/View/SubMenu/Timeline/Attack.elm b/src/roster-editor/src/View/SubMenu/Timeline/Attack.elm
index 682540d..682540d 100644
--- a/src/character/src/View/SubMenu/Timeline/Attack.elm
+++ b/src/roster-editor/src/View/SubMenu/Timeline/Attack.elm
diff --git a/src/character/src/View/SubMenu/Timeline/Movement.elm b/src/roster-editor/src/View/SubMenu/Timeline/Movement.elm
index 0746f1f..0746f1f 100644
--- a/src/character/src/View/SubMenu/Timeline/Movement.elm
+++ b/src/roster-editor/src/View/SubMenu/Timeline/Movement.elm
diff --git a/src/character/src/View/SubMenu/Timeline/PlayerDefeat.elm b/src/roster-editor/src/View/SubMenu/Timeline/PlayerDefeat.elm
index db5e023..db5e023 100644
--- a/src/character/src/View/SubMenu/Timeline/PlayerDefeat.elm
+++ b/src/roster-editor/src/View/SubMenu/Timeline/PlayerDefeat.elm
diff --git a/src/character/src/View/SubMenu/Timeline/PlayerTurnStart.elm b/src/roster-editor/src/View/SubMenu/Timeline/PlayerTurnStart.elm
index a6486fa..a6486fa 100644
--- a/src/character/src/View/SubMenu/Timeline/PlayerTurnStart.elm
+++ b/src/roster-editor/src/View/SubMenu/Timeline/PlayerTurnStart.elm
diff --git a/src/character/src/View/SubMenu/Timeline/PlayerVictory.elm b/src/roster-editor/src/View/SubMenu/Timeline/PlayerVictory.elm
index 4d47f62..4d47f62 100644
--- a/src/character/src/View/SubMenu/Timeline/PlayerVictory.elm
+++ b/src/roster-editor/src/View/SubMenu/Timeline/PlayerVictory.elm
diff --git a/src/character/src/View/SubMenu/Timeline/WeaponSwitch.elm b/src/roster-editor/src/View/SubMenu/Timeline/WeaponSwitch.elm
index 499e0c3..499e0c3 100644
--- a/src/character/src/View/SubMenu/Timeline/WeaponSwitch.elm
+++ b/src/roster-editor/src/View/SubMenu/Timeline/WeaponSwitch.elm
diff --git a/src/character/www/index.html b/src/roster-editor/www/index.html
index 65f0d02..a2a6034 100644
--- a/src/character/www/index.html
+++ b/src/roster-editor/www/index.html
@@ -2,7 +2,7 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="../css/global.css">
- <link rel="stylesheet" type="text/css" href="../css/character.css">
+ <link rel="stylesheet" type="text/css" href="../css/roster-editor.css">
<link rel="stylesheet" type="text/css" href="../asset/characters.css">
<link rel="stylesheet" type="text/css" href="../asset/armors.css">
<link rel="icon" type="image/x-icon" href="/favicon.ico">