| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-04-16 16:32:21 +0200 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-04-16 16:32:21 +0200 | 
| commit | 3a5dda503260eb990a14f8f73f5662dc51c95e1a (patch) | |
| tree | b95184ddbc526f9132e99d6b4b638afd2881d97b | |
| parent | 27682ed9f810c3a69305308df0d3b696b6ceeda3 (diff) | |
Forgot file.
| -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 +         ) | 


