summaryrefslogtreecommitdiff |
diff options
-rw-r--r-- | src/battlemap/src/Update/AttackWithoutMoving.elm | 45 |
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 + ) |