Skip to content

Commit

Permalink
Add rules for advancing the turn
Browse files Browse the repository at this point in the history
  • Loading branch information
mwunsch committed Oct 18, 2016
1 parent 9f6e839 commit c40be00
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Main.elm
Expand Up @@ -17,6 +17,7 @@ import Svg exposing (..)
import Svg.Attributes exposing (..)
import Tabletop exposing (Tabletop, positionFromMouseCoords)
import Task
import Turn exposing (Turn)
import Window


Expand All @@ -39,6 +40,7 @@ type alias GameState =
, tabletop : Tabletop
, windowWidth : Int
, windowScale : Float
, turn : Turn
}


Expand All @@ -52,6 +54,7 @@ init =
, tabletop = table
, windowWidth = 1000
, windowScale = 10
, turn = Turn.init
}
, Cmd.batch
[ Task.perform (always NoOp) Resize Window.width
Expand Down Expand Up @@ -201,5 +204,6 @@ view game =
:: measuringTape
++ Gang.view game.player.gang Select
)
, Html.strong [] [ Html.text (toString game.turn.phase) ]
, selectedFighterProfile
]
39 changes: 38 additions & 1 deletion src/Turn.elm
@@ -1,3 +1,40 @@
module Turn exposing (..)

type Phase = Movement | Shooting | HandToHand | Recovery

type Phase
= Movement
| Shooting
| HandToHand
| Recovery


type alias Turn =
{ round : Int
, phase : Phase
}


init : Turn
init =
{ round = 1
, phase = Movement
}


advance : Turn -> Turn
advance turn =
case turn.phase of
Movement ->
{ turn | phase = Shooting }

Shooting ->
{ turn | phase = HandToHand }

HandToHand ->
{ turn | phase = Recovery }

Recovery ->
{ turn
| round = turn.round + 1
, phase = Movement
}

0 comments on commit c40be00

Please sign in to comment.