Skip to content

Commit

Permalink
Parameterize Shoot action with Weapon
Browse files Browse the repository at this point in the history
  • Loading branch information
mwunsch committed Nov 9, 2016
1 parent 7735a65 commit ad59087
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/Action.elm
Expand Up @@ -13,6 +13,7 @@ import Svg.Attributes exposing (..)
import Tabletop exposing (Inch, posX, posY, transformTranslate)
import Turn exposing (Turn, Phase(..))
import Utilities exposing (onClickWithoutPropagation, textNode)
import Weapons exposing (Weapon, autogun)


type Action
Expand All @@ -22,7 +23,7 @@ type Action
| Charge
| Run
| Hide
| Shoot
| Shoot Weapon
| Fight


Expand All @@ -35,7 +36,7 @@ select phase =

Shooting ->
-- [ Cancel,
[ Shoot ]
[ Shoot autogun ]

HandToHand ->
[ Cancel ]
Expand Down Expand Up @@ -66,7 +67,7 @@ symbol action =
Run ->
"R"

Shoot ->
Shoot weapon ->
"S"

_ ->
Expand Down
4 changes: 2 additions & 2 deletions src/Main.elm
Expand Up @@ -96,7 +96,7 @@ update msg game =
case msg of
Select model ->
case game.player.action of
Action.Shoot ->
Action.Shoot _ ->
case Player.getSelectedGangMember game.player of
Just fighter ->
Player.execute (Player.Shooting fighter model) game.player
Expand Down Expand Up @@ -158,7 +158,7 @@ update msg game =
Action.Run ->
Just ( "lightblue", "Click to run to a point" )

Action.Shoot ->
Action.Shoot _ ->
Just ( "red", "Select a target" )

_ ->
Expand Down
3 changes: 2 additions & 1 deletion src/Player.elm
Expand Up @@ -8,6 +8,7 @@ import Svg exposing (Svg, g)
import Tabletop exposing (Tabletop, Position)
import Task exposing (Task)
import Turn exposing (Phase)
import Weapons exposing (autogun)


type alias Player =
Expand Down Expand Up @@ -110,7 +111,7 @@ execute instruction player =

Shooting attacker target ->
( { player | target = Just target.id }
, Task.succeed Shoot
, Task.succeed (Shoot autogun)
)


Expand Down

0 comments on commit ad59087

Please sign in to comment.