aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2018-04-16 16:32:21 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2018-04-16 16:32:21 +0200
commit3a5dda503260eb990a14f8f73f5662dc51c95e1a (patch)
treeb95184ddbc526f9132e99d6b4b638afd2881d97b
parent27682ed9f810c3a69305308df0d3b696b6ceeda3 (diff)
downloadtacticians-client-3a5dda503260eb990a14f8f73f5662dc51c95e1a.zip
tacticians-client-3a5dda503260eb990a14f8f73f5662dc51c95e1a.tar.bz2
Forgot file.
-rw-r--r--src/battlemap/src/Update/AttackWithoutMoving.elm45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/battlemap/src/Update/AttackWithoutMoving.elm b/src/battlemap/src/Update/AttackWithoutMoving.elm
new file mode 100644
index 0000000..639d90e
--- /dev/null
+++ b/src/battlemap/src/Update/AttackWithoutMoving.elm
@@ -0,0 +1,45 @@
+module Update.AttackWithoutMoving exposing (apply_to)
+
+-- Elm -------------------------------------------------------------------------
+
+-- Battlemap -------------------------------------------------------------------
+import Struct.CharacterTurn
+import Struct.Error
+import Struct.Event
+import Struct.Model
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+make_it_so : Struct.Model.Type -> Struct.Model.Type
+make_it_so model =
+ {model |
+ char_turn = (Struct.CharacterTurn.lock_path model.char_turn)
+ }
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+apply_to : (
+ Struct.Model.Type ->
+ (Struct.Model.Type, (Cmd Struct.Event.Type))
+ )
+apply_to model =
+ case (Struct.CharacterTurn.get_state model.char_turn) of
+ Struct.CharacterTurn.SelectedCharacter ->
+ ((make_it_so model), Cmd.none)
+
+ _ ->
+ (
+ (Struct.Model.invalidate
+ model
+ (Struct.Error.new
+ Struct.Error.Programming
+ (
+ "Attempt to do an attack without moving, despite no"
+ ++ "character being selected."
+ )
+ )
+ ),
+ Cmd.none
+ )