aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2020-01-17 16:40:14 +0100
committernsensfel <SpamShield0@noot-noot.org>2020-01-17 16:40:14 +0100
commit58563feda3d20ac636714836275d7e2f0dc04519 (patch)
tree3436e210666809c181a1fcd2f604354caff80d34
parentcebe6abfe3a72e18c0e09963709392dffc8b4a69 (diff)
downloadtacticians-client-skills_and_conditions.zip
tacticians-client-skills_and_conditions.tar.bz2
-rw-r--r--src/battle/src/Struct/PuppeteerAction.elm4
-rw-r--r--src/battle/src/Update/EndTurn.elm17
-rw-r--r--src/battle/src/Update/HandleServerReply.elm30
-rw-r--r--src/battle/src/Update/Puppeteer.elm235
-rw-r--r--src/battle/src/Update/Puppeteer/AnnounceLoss.elm12
-rw-r--r--src/battle/src/Update/Puppeteer/Focus.elm28
-rw-r--r--src/battle/src/Update/Puppeteer/Hit.elm10
-rw-r--r--src/battle/src/Update/Puppeteer/Move.elm63
-rw-r--r--src/battle/src/Update/Puppeteer/RefreshCharacter.elm9
-rw-r--r--src/battle/src/Update/Puppeteer/RefreshCharactersOf.elm2
-rw-r--r--src/battle/src/Update/Puppeteer/StartTurn.elm12
-rw-r--r--src/battle/src/Update/Puppeteer/SwapWeapons.elm37
-rw-r--r--src/battle/src/Update/RequestDirection.elm1
-rw-r--r--src/battle/src/Update/SelectCharacter.elm1
-rw-r--r--src/battle/src/Update/SelectTile.elm2
-rw-r--r--src/battle/src/Update/UndoAction.elm2
-rw-r--r--src/battle/src/View/Map.elm11
-rw-r--r--src/battle/src/View/MessageBoard.elm10
-rw-r--r--src/battle/src/View/SubMenu/Status.elm8
-rw-r--r--src/shared/battle-map/BattleMap/View/TileInfo.elm4
20 files changed, 296 insertions, 202 deletions
diff --git a/src/battle/src/Struct/PuppeteerAction.elm b/src/battle/src/Struct/PuppeteerAction.elm
index f1f975d..5580409 100644
--- a/src/battle/src/Struct/PuppeteerAction.elm
+++ b/src/battle/src/Struct/PuppeteerAction.elm
@@ -171,8 +171,8 @@ from_player_turn_started turn_started =
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-from_turn_results : Struct.TurnResult.Type -> (List Type)
-from_turn_results turn_result =
+from_turn_result : Struct.TurnResult.Type -> (List Type)
+from_turn_result turn_result =
case turn_result of
(Struct.TurnResult.Moved movement) -> (from_moved movement)
(Struct.TurnResult.Attacked attack) -> (from_attacked attack)
diff --git a/src/battle/src/Update/EndTurn.elm b/src/battle/src/Update/EndTurn.elm
index 5cafc48..bc7631b 100644
--- a/src/battle/src/Update/EndTurn.elm
+++ b/src/battle/src/Update/EndTurn.elm
@@ -3,6 +3,7 @@ module Update.EndTurn exposing (apply_to)
-- Local Module ----------------------------------------------------------------
import Comm.CharacterTurn
+import Struct.Battle
import Struct.Character
import Struct.CharacterTurn
import Struct.Error
@@ -32,13 +33,15 @@ make_it_so model char nav =
case (Comm.CharacterTurn.try model) of
(Just cmd) ->
(
- (Struct.Model.reset
- (Struct.Model.update_character
- (Struct.Character.get_index char)
- (maybe_disable_char)
- model
- )
- ),
+ {model |
+ char_turn = (Struct.CharacterTurn.new),
+ battle =
+ (Struct.Battle.update_character
+ (Struct.Character.get_index char)
+ (maybe_disable_char)
+ model.battle
+ )
+ },
cmd
)
diff --git a/src/battle/src/Update/HandleServerReply.elm b/src/battle/src/Update/HandleServerReply.elm
index a7fcb71..6c16480 100644
--- a/src/battle/src/Update/HandleServerReply.elm
+++ b/src/battle/src/Update/HandleServerReply.elm
@@ -25,6 +25,7 @@ import BattleCharacters.Struct.DataSetItem
-- Battle Map ------------------------------------------------------------------
import BattleMap.Struct.DataSet
+import BattleMap.Struct.DataSetItem
import BattleMap.Struct.Map
import BattleMap.Struct.Tile
@@ -38,6 +39,7 @@ import Struct.Event
import Struct.Model
import Struct.Player
import Struct.Puppeteer
+import Struct.PuppeteerAction
import Struct.ServerReply
import Struct.TurnResult
@@ -138,7 +140,7 @@ add_character unresolved_char current_state =
(Struct.Battle.add_character
(Struct.Character.resolve
(\loc ->
- (BattleMap.Struct.Map.tile_omnimods_fun
+ (BattleMap.Struct.Map.get_omnimods_at
loc
model.map_dataset
(Struct.Battle.get_map model.battle)
@@ -182,20 +184,17 @@ add_to_timeline : (
add_to_timeline turn_results current_state =
let
(model, cmds) = current_state
- (next_model, more_cmds) =
+ (next_model, new_cmd) =
(Update.Puppeteer.apply_to
(
{model |
puppeteer =
(List.foldl
- (\tr puppeteer ->
- (Struct.Puppeteer.append_forward
- (Struct.PuppeteerAction.from_turn_result tr)
- puppeteer
- )
+ (\action puppeteer ->
+ (Struct.Puppeteer.append_forward action puppeteer)
)
model.puppeteer
- turn_results
+ (Struct.PuppeteerAction.from_turn_results turn_results)
),
battle =
(Struct.Battle.set_timeline
@@ -211,9 +210,9 @@ add_to_timeline turn_results current_state =
in
(
next_model,
- if (mode_cmds == Cmd.none)
- then cmd
- else [more_cmds|cmd]
+ if (new_cmd == Cmd.none)
+ then cmds
+ else (new_cmd :: cmds)
)
set_timeline : (
@@ -227,14 +226,11 @@ set_timeline turn_results current_state =
{model |
puppeteer =
(List.foldr
- (\tr puppeteer ->
- (Struct.Puppeteer.append_backward
- (Struct.PuppeteerAction.from_turn_result tr)
- puppeteer
- )
+ (\action puppeteer ->
+ (Struct.Puppeteer.append_backward action puppeteer)
)
model.puppeteer
- turn_results
+ (Struct.PuppeteerAction.from_turn_results turn_results)
),
battle =
(Struct.Battle.set_timeline
diff --git a/src/battle/src/Update/Puppeteer.elm b/src/battle/src/Update/Puppeteer.elm
index 206b411..dcdefcc 100644
--- a/src/battle/src/Update/Puppeteer.elm
+++ b/src/battle/src/Update/Puppeteer.elm
@@ -23,95 +23,145 @@ import Update.Puppeteer.Target
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-apply_effect_forward : (
+forward : (
Struct.PuppeteerAction.Effect ->
Struct.Model.Type ->
(Struct.Model.Type, (List (Cmd Struct.Event.Type)))
)
-apply_effect_forward effect model =
+forward effect model =
case effect of
- (AnnounceLoss player_ix) ->
- (Update.PuppeteerAction.AnnounceLoss.forward player_ix model)
+ (Struct.PuppeteerAction.AnnounceLoss player_ix) ->
+ (Update.Puppeteer.AnnounceLoss.forward player_ix model)
- (AnnounceVictory player_ix) ->
- (Update.PuppeteerAction.AnnounceVictory.forward player_ix model)
+ (Struct.PuppeteerAction.AnnounceVictory player_ix) ->
+ (Update.Puppeteer.AnnounceVictory.forward player_ix model)
- (Focus character_ix) ->
- (Update.PuppeteerAction.Focus.forward character_ix model)
+ (Struct.PuppeteerAction.Focus character_ix) ->
+ (Update.Puppeteer.Focus.forward character_ix model)
- (Hit attack) ->
- (Update.PuppeteerAction.Hit.forward attack model)
+ (Struct.PuppeteerAction.Hit attack) ->
+ (Update.Puppeteer.Hit.forward attack model)
- (Move (character_ix, direction)) ->
- (Update.PuppeteerAction.Move.forward character_ix direction model)
+ (Struct.PuppeteerAction.Move (character_ix, direction)) ->
+ (Update.Puppeteer.Move.forward character_ix direction model)
- (RefreshCharacter (on_forward, character_ix)) ->
- (Update.PuppeteerAction.RefreshCharacter.forward
+ (Struct.PuppeteerAction.RefreshCharacter (on_forward, character_ix)) ->
+ (Update.Puppeteer.RefreshCharacter.forward
on_forward
character_ix
model
)
- (RefreshCharactersOf (on_forward, player_ix)) ->
- (Update.PuppeteerAction.RefreshCharactersOf.forward
+ (Struct.PuppeteerAction.RefreshCharactersOf (on_forward, player_ix)) ->
+ (Update.Puppeteer.RefreshCharactersOf.forward
on_forward
player_ix
model
)
- (StartTurn player_ix) ->
- (Update.PuppeteerAction.StartTurn.forward player_ix model)
+ (Struct.PuppeteerAction.StartTurn player_ix) ->
+ (Update.Puppeteer.StartTurn.forward player_ix model)
- (SwapWeapons character_ix) ->
- (Update.PuppeteerAction.SwapWeapons.forward character_ix model)
+ (Struct.PuppeteerAction.SwapWeapons character_ix) ->
+ (Update.Puppeteer.SwapWeapons.forward character_ix model)
- (Target (actor_ix, target_ix)) ->
- (Update.PuppeteerAction.Target.forward actor_ix target_ix model)
+ (Struct.PuppeteerAction.Target (actor_ix, target_ix)) ->
+ (Update.Puppeteer.Target.forward actor_ix target_ix model)
-apply_effect_backward : (
+backward : (
Struct.PuppeteerAction.Effect ->
Struct.Model.Type ->
(Struct.Model.Type, (List (Cmd Struct.Event.Type)))
)
-apply_effect_backward effect model =
+backward effect model =
case effect of
- (AnnounceLoss player_ix) ->
- (Update.PuppeteerAction.AnnounceLoss.backward player_ix model)
+ (Struct.PuppeteerAction.AnnounceLoss player_ix) ->
+ (Update.Puppeteer.AnnounceLoss.backward player_ix model)
- (AnnounceVictory player_ix) ->
- (Update.PuppeteerAction.AnnounceVictory.backward player_ix model)
+ (Struct.PuppeteerAction.AnnounceVictory player_ix) ->
+ (Update.Puppeteer.AnnounceVictory.backward player_ix model)
- (Focus character_ix) ->
- (Update.PuppeteerAction.Focus.backward character_ix model)
+ (Struct.PuppeteerAction.Focus character_ix) ->
+ (Update.Puppeteer.Focus.backward character_ix model)
- (Hit attack) ->
- (Update.PuppeteerAction.Hit.backward attack model)
+ (Struct.PuppeteerAction.Hit attack) ->
+ (Update.Puppeteer.Hit.backward attack model)
- (Move (character_ix, direction)) ->
- (Update.PuppeteerAction.Move.backward character_ix direction model)
+ (Struct.PuppeteerAction.Move (character_ix, direction)) ->
+ (Update.Puppeteer.Move.backward character_ix direction model)
- (RefreshCharacter (on_forward, character_ix)) ->
- (Update.PuppeteerAction.RefreshCharacter.backward
- on_backward
+ (Struct.PuppeteerAction.RefreshCharacter (on_forward, character_ix)) ->
+ (Update.Puppeteer.RefreshCharacter.backward
+ on_forward
character_ix
model
)
- (RefreshCharactersOf (on_forward, player_ix)) ->
- (Update.PuppeteerAction.RefreshCharactersOf.backward
+ (Struct.PuppeteerAction.RefreshCharactersOf (on_forward, player_ix)) ->
+ (Update.Puppeteer.RefreshCharactersOf.backward
on_forward
player_ix
model
)
- (StartTurn player_ix) ->
- (Update.PuppeteerAction.StartTurn.backward player_ix model)
+ (Struct.PuppeteerAction.StartTurn player_ix) ->
+ (Update.Puppeteer.StartTurn.backward player_ix model)
- (SwapWeapons character_ix) ->
- (Update.PuppeteerAction.SwapWeapons.backward character_ix model)
+ (Struct.PuppeteerAction.SwapWeapons character_ix) ->
+ (Update.Puppeteer.SwapWeapons.backward character_ix model)
- (Target (actor_ix, target_ix)) ->
- (Update.PuppeteerAction.Target.backward actor_ix target_ix model)
+ (Struct.PuppeteerAction.Target (actor_ix, target_ix)) ->
+ (Update.Puppeteer.Target.backward actor_ix target_ix model)
+
+apply_effects_forward : (
+ (List Struct.PuppeteerAction.Effect) ->
+ Struct.Model.Type ->
+ (Struct.Model.Type, (List (Cmd Struct.Event.Type)))
+ )
+apply_effects_forward effects model =
+ (List.foldl
+ (\effect (current_model, current_cmds) ->
+ let
+ (updated_model, new_commands) = (forward effect current_model)
+ in
+ (
+ {updated_model|
+ puppeteer =
+ (Struct.Puppeteer.forward
+ updated_model.puppeteer
+ )
+ },
+ (new_commands ++ current_cmds)
+ )
+ )
+ (model, [])
+ effects
+ )
+
+apply_effects_backward : (
+ (List Struct.PuppeteerAction.Effect) ->
+ Struct.Model.Type ->
+ (Struct.Model.Type, (List (Cmd Struct.Event.Type)))
+ )
+apply_effects_backward effects model =
+ (List.foldr
+ (\effect (current_model, current_cmds) ->
+ let
+ (updated_model, new_commands) = (backward effect current_model)
+ in
+ (
+ {updated_model|
+ puppeteer =
+ (Struct.Puppeteer.backward
+ updated_model.puppeteer
+ )
+ },
+ (current_cmds ++ new_commands)
+ )
+ )
+ (model, [])
+ effects
+ )
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
@@ -125,56 +175,55 @@ apply_to model =
Nothing -> (model, (Cmd.none))
(Just action) ->
case action of
- (Perform effects) ->
- if (Struct.Puppeteer.get_is_playing_forward model.puppeteer)
- then
- -- TODO: iterate over the effects
- let updated_model = (forward effect model) in
- (apply_to
- {updated_model|
- puppeteer =
- (Struct.Puppeteer.forward
- updated_model.puppeteer
- )
- }
+ (Struct.PuppeteerAction.Perform effects) ->
+ let
+ (new_model, cmds) =
+ (
+ if
+ (Struct.Puppeteer.get_is_playing_forward
+ model.puppeteer
+ )
+ then (apply_effects_forward effects model)
+ else (apply_effects_backward effects model)
)
- else
- -- TODO: iterate over the effects
- let updated_model = (backward effect model) in
- (apply_to
- {updated_model|
- puppeteer =
- (Struct.Puppeteer.backward
- updated_model.puppeteer
- )
- }
+ in
+ (
+ new_model,
+ if (List.isEmpty cmds)
+ then (Cmd.none)
+ else (Cmd.batch cmds)
+ )
+
+ (Struct.PuppeteerAction.PerformFor (time, effects)) ->
+ let
+ (new_model, cmds) =
+ (
+ if
+ (Struct.Puppeteer.get_is_playing_forward
+ model.puppeteer
+ )
+ then (apply_effects_forward effects model)
+ else (apply_effects_backward effects model)
)
-
- (PerformFor (time, effects)) ->
- (
+ in
(
- if
- (Struct.Puppeteer.get_is_playing_forward
- model.puppeteer
- )
+ new_model,
+ if (List.isEmpty cmds)
then
- -- TODO: iterate over the effects
- let updated_model = (forward effect model) in
- {updated_model|
- puppeteer =
- (Struct.Puppeteer.forward
- updated_model.puppeteer
- )
- }
+ (Delay.after
+ time
+ Delay.Second
+ Struct.Event.AnimationEnded
+ )
else
- -- TODO: iterate over the effects
- let updated_model = (backward effect model) in
- {updated_model|
- puppeteer =
- (Struct.Puppeteer.backward
- updated_model.puppeteer
- )
- }
- ),
- (Delay.after time Delay.Second Struct.Event.AnimationEnded)
- )
+ (Cmd.batch
+ (
+ (Delay.after
+ time
+ Delay.Second
+ Struct.Event.AnimationEnded
+ )
+ :: cmds
+ )
+ )
+ )
diff --git a/src/battle/src/Update/Puppeteer/AnnounceLoss.elm b/src/battle/src/Update/Puppeteer/AnnounceLoss.elm
index 0e4c320..b6c667c 100644
--- a/src/battle/src/Update/Puppeteer/AnnounceLoss.elm
+++ b/src/battle/src/Update/Puppeteer/AnnounceLoss.elm
@@ -1,5 +1,8 @@
module Update.Puppeteer.AnnounceLoss exposing (forward, backward)
+-- Elm -------------------------------------------------------------------------
+import Array
+
-- Local Module ----------------------------------------------------------------
import Struct.Battle
import Struct.Character
@@ -22,12 +25,17 @@ set_player_is_defeated val player_ix model =
(Struct.Battle.set_characters
(Array.map
(\character ->
- if ((Struct.Character.get_player_index c) == player_ix)
+ if
+ (
+ (Struct.Character.get_player_index character)
+ == player_ix
+ )
then (Struct.Character.set_defeated val character)
else character
)
+ (Struct.Battle.get_characters model.battle)
)
- (Struct.Battle.get_characters model.battle)
+ model.battle
)
},
[]
diff --git a/src/battle/src/Update/Puppeteer/Focus.elm b/src/battle/src/Update/Puppeteer/Focus.elm
index e76b7fc..4e72a53 100644
--- a/src/battle/src/Update/Puppeteer/Focus.elm
+++ b/src/battle/src/Update/Puppeteer/Focus.elm
@@ -1,5 +1,8 @@
module Update.Puppeteer.Focus exposing (forward, backward)
+-- Elm -------------------------------------------------------------------------
+import Task
+
-- Local Module ----------------------------------------------------------------
import Action.Scroll
@@ -22,20 +25,21 @@ forward : (
(Struct.Model.Type, (List (Cmd Struct.Event.Type)))
)
forward actor_ix model =
- (
- model,
- [
- (Task.attempt
- (Struct.Event.attempted)
- (Action.Scroll.to
- (Struct.Character.get_location
- (Struct.Battle.get_character actor_ix model.battle)
+ case (Struct.Battle.get_character actor_ix model.battle) of
+ Nothing -> (model, [])
+ (Just character) ->
+ (
+ model,
+ [
+ (Task.attempt
+ (Struct.Event.attempted)
+ (Action.Scroll.to
+ (Struct.Character.get_location character)
+ model.ui
+ )
)
- model.ui
- )
+ ]
)
- ]
- )
backward : (
Int ->
diff --git a/src/battle/src/Update/Puppeteer/Hit.elm b/src/battle/src/Update/Puppeteer/Hit.elm
index 7465e7c..2584030 100644
--- a/src/battle/src/Update/Puppeteer/Hit.elm
+++ b/src/battle/src/Update/Puppeteer/Hit.elm
@@ -35,7 +35,7 @@ apply_to_characters : (
(Array.Array Struct.Character.Type)
)
apply_to_characters attacker_ix defender_ix attack characters =
- if ((attack.order == Counter) == attack.parried)
+ if ((attack.order == Struct.Attack.Counter) == attack.parried)
then
case (Array.get defender_ix characters) of
(Just char) ->
@@ -65,7 +65,7 @@ apply_inverse_to_characters : (
(Array.Array Struct.Character.Type)
)
apply_inverse_to_characters attacker_ix defender_ix attack characters =
- if ((attack.order == Counter) == attack.parried)
+ if ((attack.order == Struct.Attack.Counter) == attack.parried)
then
case (Array.get defender_ix characters) of
(Just char) ->
@@ -91,18 +91,16 @@ apply_inverse_to_characters attacker_ix defender_ix attack characters =
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
forward : (
- Int ->
Struct.Attack.Type ->
Struct.Model.Type ->
(Struct.Model.Type, (List (Cmd Struct.Event.Type)))
)
-forward actor_ix hit model = (model, [])
+forward hit model = (model, [])
backward : (
- Int ->
Struct.Attack.Type ->
Struct.Model.Type ->
(Struct.Model.Type, (List (Cmd Struct.Event.Type)))
)
-backward actor_ix hit model = (model, [])
+backward hit model = (model, [])
diff --git a/src/battle/src/Update/Puppeteer/Move.elm b/src/battle/src/Update/Puppeteer/Move.elm
index 6e5b3fd..4d50af8 100644
--- a/src/battle/src/Update/Puppeteer/Move.elm
+++ b/src/battle/src/Update/Puppeteer/Move.elm
@@ -9,6 +9,7 @@ import Action.Scroll
import Struct.Battle
import Struct.Character
+import Struct.Error
import Struct.Event
import Struct.Model
import Struct.UI
@@ -23,24 +24,37 @@ apply_direction_to_character : (
(Struct.Model.Type, (List (Cmd Struct.Event.Type)))
)
apply_direction_to_character actor_ix direction model =
- let character = (Struct.Battle.get_character actor_ix model.battle) in
- (
- {model |
- battle =
- (Struct.Battle.set_character
- actor_ix
- (Struct.Character.dirty_set_location
- (BattleMap.Struct.Location.neighbor
- direction
- (Struct.Character.get_location character)
+ case (Struct.Battle.get_character actor_ix model.battle) of
+ Nothing ->
+ (
+ (Struct.Model.invalidate
+ (Struct.Error.new
+ Struct.Error.Failure
+ ("Could not find character " ++ (String.fromInt actor_ix))
+ )
+ model
+ ),
+ []
+ )
+
+ (Just character) ->
+ (
+ {model |
+ battle =
+ (Struct.Battle.set_character
+ actor_ix
+ (Struct.Character.dirty_set_location
+ (BattleMap.Struct.Location.neighbor
+ direction
+ (Struct.Character.get_location character)
+ )
+ character
)
- character
+ model.battle
)
- model.battle
- )
- },
- []
- )
+ },
+ []
+ )
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
@@ -52,11 +66,7 @@ forward : (
(Struct.Model.Type, (List (Cmd Struct.Event.Type)))
)
forward actor_ix direction model =
- (
- (apply_direction_to_character actor_ix direction model),
- []
- )
-
+ (apply_direction_to_character actor_ix direction model)
backward : (
Int ->
@@ -65,11 +75,8 @@ backward : (
(Struct.Model.Type, (List (Cmd Struct.Event.Type)))
)
backward actor_ix direction model =
- (
- (apply_direction_to_character
- actor_ix
- (BattleMap.Struct.Direction.opposite_of direction)
- model
- ),
- []
+ (apply_direction_to_character
+ actor_ix
+ (BattleMap.Struct.Direction.opposite_of direction)
+ model
)
diff --git a/src/battle/src/Update/Puppeteer/RefreshCharacter.elm b/src/battle/src/Update/Puppeteer/RefreshCharacter.elm
index a392238..fa416a9 100644
--- a/src/battle/src/Update/Puppeteer/RefreshCharacter.elm
+++ b/src/battle/src/Update/Puppeteer/RefreshCharacter.elm
@@ -16,7 +16,12 @@ perform : (
perform actor_ix model =
(
{model |
- battle = (Struct.Battle.refresh_character actor_ix model.battle)
+ battle =
+ (Struct.Battle.refresh_character
+ model.map_data_set
+ actor_ix
+ model.battle
+ )
},
[]
)
@@ -41,7 +46,7 @@ backward : (
Struct.Model.Type ->
(Struct.Model.Type, (List (Cmd Struct.Event.Type)))
)
-backward is_forward actor_ix model = (model, [])
+backward is_forward actor_ix model =
if (is_forward)
then (model, [])
else (perform actor_ix model)
diff --git a/src/battle/src/Update/Puppeteer/RefreshCharactersOf.elm b/src/battle/src/Update/Puppeteer/RefreshCharactersOf.elm
index a83cc91..29417c6 100644
--- a/src/battle/src/Update/Puppeteer/RefreshCharactersOf.elm
+++ b/src/battle/src/Update/Puppeteer/RefreshCharactersOf.elm
@@ -26,6 +26,7 @@ perform player_ix model =
if ((Struct.Character.get_player_index actor) == player_ix)
then
(Struct.Battle.refresh_character
+ model.map_data_set
(Struct.Character.get_index actor)
battle
)
@@ -53,6 +54,7 @@ forward is_forward player_ix model =
else (model, [])
backward : (
+ Bool ->
Int ->
Struct.Model.Type ->
(Struct.Model.Type, (List (Cmd Struct.Event.Type)))
diff --git a/src/battle/src/Update/Puppeteer/StartTurn.elm b/src/battle/src/Update/Puppeteer/StartTurn.elm
index 9681198..da9c814 100644
--- a/src/battle/src/Update/Puppeteer/StartTurn.elm
+++ b/src/battle/src/Update/Puppeteer/StartTurn.elm
@@ -1,5 +1,8 @@
module Update.Puppeteer.StartTurn exposing (forward, backward)
+-- Elm -------------------------------------------------------------------------
+import Array
+
-- Local Module ----------------------------------------------------------------
import Struct.Battle
import Struct.Character
@@ -22,12 +25,17 @@ set_player_characters_are_enabled val player_ix model =
(Struct.Battle.set_characters
(Array.map
(\character ->
- if ((Struct.Character.get_player_index c) == player_ix)
+ if
+ (
+ (Struct.Character.get_player_index character)
+ == player_ix
+ )
then (Struct.Character.set_enabled val character)
else character
)
+ (Struct.Battle.get_characters model.battle)
)
- (Struct.Battle.get_characters model.battle)
+ model.battle
)
},
[]
diff --git a/src/battle/src/Update/Puppeteer/SwapWeapons.elm b/src/battle/src/Update/Puppeteer/SwapWeapons.elm
index 27b81b5..b31d939 100644
--- a/src/battle/src/Update/Puppeteer/SwapWeapons.elm
+++ b/src/battle/src/Update/Puppeteer/SwapWeapons.elm
@@ -15,6 +15,19 @@ import Struct.UI
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
+make_it_so : (Maybe Struct.Character.Type) -> (Maybe Struct.Character.Type)
+make_it_so maybe_character =
+ case maybe_character of
+ Nothing -> Nothing
+ (Just character) ->
+ (Just
+ (Struct.Character.set_base_character
+ (BattleCharacters.Struct.Character.dirty_switch_weapons
+ (Struct.Character.get_base_character character)
+ )
+ character
+ )
+ )
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
@@ -25,23 +38,13 @@ forward : (
(Struct.Model.Type, (List (Cmd Struct.Event.Type)))
)
forward actor_ix model =
- let character = (Struct.Battle.get_character actor_ix model.battle) in
- (
- {model |
- battle =
- (Struct.Battle.set_character
- actor_ix
- (Struct.Character.set_base_character
- (BattleCharacters.Struct.Character.dirty_switch_weapons
- (Struct.Character.get_base_character character)
- )
- character
- )
- model.battle
- )
- },
- []
- )
+ (
+ {model |
+ battle =
+ (Struct.Battle.update_character actor_ix (make_it_so) model.battle)
+ },
+ []
+ )
backward : (
diff --git a/src/battle/src/Update/RequestDirection.elm b/src/battle/src/Update/RequestDirection.elm
index de46ecc..de301c0 100644
--- a/src/battle/src/Update/RequestDirection.elm
+++ b/src/battle/src/Update/RequestDirection.elm
@@ -8,6 +8,7 @@ import BattleMap.Struct.Map
import BattleCharacters.Struct.Character
-- Local Module ----------------------------------------------------------------
+import Struct.Battle
import Struct.Character
import Struct.CharacterTurn
import Struct.Error
diff --git a/src/battle/src/Update/SelectCharacter.elm b/src/battle/src/Update/SelectCharacter.elm
index 57e1317..656a5db 100644
--- a/src/battle/src/Update/SelectCharacter.elm
+++ b/src/battle/src/Update/SelectCharacter.elm
@@ -19,6 +19,7 @@ import BattleMap.Struct.Location
-- Local Module ----------------------------------------------------------------
import Action.Scroll
+import Struct.Battle
import Struct.Character
import Struct.CharacterTurn
import Struct.Error
diff --git a/src/battle/src/Update/SelectTile.elm b/src/battle/src/Update/SelectTile.elm
index c5d9f36..ebc7cd1 100644
--- a/src/battle/src/Update/SelectTile.elm
+++ b/src/battle/src/Update/SelectTile.elm
@@ -3,11 +3,13 @@ module Update.SelectTile exposing (apply_to)
-- Battle Map -------------------------------------------------------------------
import BattleMap.Struct.Direction
import BattleMap.Struct.Location
+import BattleMap.Struct.Map
-- Battle Characters ------------------------------------------------------------
import BattleCharacters.Struct.Character
-- Local Module ----------------------------------------------------------------
+import Struct.Battle
import Struct.Character
import Struct.CharacterTurn
import Struct.Error
diff --git a/src/battle/src/Update/UndoAction.elm b/src/battle/src/Update/UndoAction.elm
index a0c8b0f..dc5b025 100644
--- a/src/battle/src/Update/UndoAction.elm
+++ b/src/battle/src/Update/UndoAction.elm
@@ -42,7 +42,7 @@ get_character_navigator battle char =
(BattleCharacters.Struct.Weapon.get_defense_range weapon)
(BattleCharacters.Struct.Weapon.get_attack_range weapon)
(BattleMap.Struct.Map.get_tile_data_function
- model.map
+ (Struct.Battle.get_map battle)
(List.map
(Struct.Character.get_location)
(Array.toList (Struct.Battle.get_characters battle))
diff --git a/src/battle/src/View/Map.elm b/src/battle/src/View/Map.elm
index d95aa21..babfcaf 100644
--- a/src/battle/src/View/Map.elm
+++ b/src/battle/src/View/Map.elm
@@ -20,6 +20,7 @@ import BattleMap.View.Tile
-- Local Module ----------------------------------------------------------------
import Constants.UI
+import Struct.Battle
import Struct.Character
import Struct.Event
import Struct.Model
@@ -98,17 +99,17 @@ maybe_print_navigator interactive maybe_nav =
(Util.Html.nothing)
get_characters_html : (
- Struct.Model.Type ->
+ Struct.Battle.Type ->
(Html.Html Struct.Event.Type)
)
-get_characters_html model =
+get_characters_html battle =
(Html.div
[
(Html.Attributes.class "characters")
]
(List.map
- (View.Map.Character.get_html model)
- (Array.toList (Struct.Battle.get_characters model.battle))
+ (View.Map.Character.get_html)
+ (Array.toList (Struct.Battle.get_characters battle))
)
)
@@ -142,7 +143,7 @@ get_html model =
]
[
(Html.Lazy.lazy (get_tiles_html) model.battle.map),
- (Html.Lazy.lazy (get_characters_html model)),
+ (Html.Lazy.lazy (get_characters_html) model.battle),
(Html.Lazy.lazy2
(maybe_print_navigator)
True
diff --git a/src/battle/src/View/MessageBoard.elm b/src/battle/src/View/MessageBoard.elm
index aebda2a..77ceccf 100644
--- a/src/battle/src/View/MessageBoard.elm
+++ b/src/battle/src/View/MessageBoard.elm
@@ -25,9 +25,13 @@ display : (
)
display model message =
case message of
- (Error error_msg) -> (View.MessageBoard.Error.get_html model error_msg)
- (AttackReport attack) -> (View.MessageBoard.Attack.get_html model attack)
- (Help help_request) ->
+ (Struct.MessageBoard.Error error_msg) ->
+ (View.MessageBoard.Error.get_html model error_msg)
+
+ (Struct.MessageBoard.AttackReport attack) ->
+ (View.MessageBoard.Attack.get_html model attack)
+
+ (Struct.MessageBoard.Help help_request) ->
(View.MessageBoard.Help.get_html model help_request)
--------------------------------------------------------------------------------
diff --git a/src/battle/src/View/SubMenu/Status.elm b/src/battle/src/View/SubMenu/Status.elm
index af5ace3..e08e786 100644
--- a/src/battle/src/View/SubMenu/Status.elm
+++ b/src/battle/src/View/SubMenu/Status.elm
@@ -13,6 +13,7 @@ import BattleMap.Struct.Location
import BattleMap.View.TileInfo
-- Local Module ----------------------------------------------------------------
+import Struct.Battle
import Struct.Event
import Struct.Model
import Struct.UI
@@ -38,17 +39,16 @@ get_html model =
(Just (Struct.UI.SelectedLocation loc)) ->
(Html.Lazy.lazy3
(BattleMap.View.TileInfo.get_html)
- model.map_dataset
+ model.map_data_set
loc
model.battle.map
)
(Just (Struct.UI.SelectedCharacter target_char)) ->
- case (Array.get target_char model.characters) of
+ case (Struct.Battle.get_character target_char model.battle) of
(Just char) ->
- (Html.Lazy.lazy2
+ (Html.Lazy.lazy
(View.SubMenu.Status.CharacterInfo.get_html)
- model.player_ix
char
)
diff --git a/src/shared/battle-map/BattleMap/View/TileInfo.elm b/src/shared/battle-map/BattleMap/View/TileInfo.elm
index 3067bcb..8769157 100644
--- a/src/shared/battle-map/BattleMap/View/TileInfo.elm
+++ b/src/shared/battle-map/BattleMap/View/TileInfo.elm
@@ -15,6 +15,7 @@ import Battle.Struct.Omnimods
import Battle.View.Omnimods
-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.DataSet
import BattleMap.Struct.Location
import BattleMap.Struct.Map
import BattleMap.Struct.Tile
@@ -127,6 +128,7 @@ get_html dataset loc_ref map =
tile_data =
(BattleMap.Struct.DataSet.get_tile
(BattleMap.Struct.TileInstance.get_class_id tile_instance)
+ dataset
)
in
(Html.div
@@ -135,7 +137,7 @@ get_html dataset loc_ref map =
(Html.Attributes.class "tile-card")
]
[
- (get_name dataset tile_data),
+ (get_name tile_data),
(Html.div
[
(Html.Attributes.class "info-card-top"),