Skip to content

Confusion with Stages #1235

@holotrek

Description

@holotrek

I'm trying to wrap my head around Stages and it is very confusing in how it relates to turns and move limit. Here is the scenario I'm trying to accomplish:

  1. Players have 1 "action" per turn
  2. Generally performing an action ends the player's turn, so I set the maxMoves to 1 in turns for the game. One such action is "Explore".
  3. However, some "actions" (let's say MoveShips) require additional "moves" that I don't want to cause the end turn, so in that case I set noLimit to true and provide an End Turn button that is the actual move that counts against the move limit.
  4. If an action has 4 associated moves, then I have to set noLimit:true on each of those moves and each one is a complex object then. It starts getting a little cumbersome. What would be nice would be if I could do something like this, but I can't seem to get it to work the way I want it within the current API:
function MoveShips({ G, events }) {
  events.setStage('moving');
}

const game = {
  moves: { Explore, MoveShips: {
    move: MoveShips,
    noLimit: true,
  }
},
  turn: {
    minMoves: 1,
    maxMoves: 1,
    stages: {
      moving: {
        minMoves: 1,
        maxMoves: undefined, // or 0 or Number.MAX_SAFE_INTEGER
        moves: { SelectOrigin, SelectDestination, ChooseShips, EndMove },
      },
    },
  },
};

I am aware minMoves and maxMoves doesn't exist on a stage, but this would be the ideal way to keep the turn going until the player initiates the EndMove move which could have a manual events.endTurn call.

What I did try was calling:

events.setStage({ stage: 'moving', maxMoves: 3 });

2 weird things with this:

  1. I'm using TypeScript and there's no definition for this method overload. It only has the one that sets the string. So I had to use (events as any) to get it to transpile. I don't understand why that overload apparently exists and sort of works, but EventsAPI doesn't have it.
  2. It went to the "moving" stage, but as soon as the player chooses SelectOrigin move, it ends the turn, so it seems to be ignoring the maxMoves setting.

I also tried this, with similar failed results:

events.setActivePlayers({ currentPlayer: 'moving', minMoves: 1, maxMoves: 3 });

What is the point of passing maxMoves when it seems to just ignore the value?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions