From 3a5dda503260eb990a14f8f73f5662dc51c95e1a Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Mon, 16 Apr 2018 16:32:21 +0200 Subject: Forgot file. --- src/battlemap/src/Update/AttackWithoutMoving.elm | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/battlemap/src/Update/AttackWithoutMoving.elm 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 + ) -- cgit v1.2.3-70-g09d2