game

package
v0.0.0-...-125c916 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	ID               string
	StartTime        time.Time
	PlayerA          string
	PlayerAUnits     []string
	PlayerAValue     int
	PlayerB          string
	PlayerBValue     int
	PlayerBUnits     []string
	Battlefieldld    string
	ActivePlayer     Player
	CurrentRound     int
	CurrentPhase     Phase
	CurrentUnitIdx   int
	CurrentUnitOrder []string
}

func New

func New(ctx context.Context, client dapr.Client, playername string) (Data, error)

func (Data) GetCurrentMoveOptions

func (g Data) GetCurrentMoveOptions(ctx context.Context, client dapr.Client) (MoveOptions, error)

func (Data) GetIndices

func (d Data) GetIndices() []string

func (Data) GetKey

func (d Data) GetKey() string

func (Data) Marshal

func (d Data) Marshal() ([]byte, error)

func (*Data) NewRound

func (g *Data) NewRound(ctx context.Context, client dapr.Client)

func (*Data) StartGame

func (g *Data) StartGame(ctx context.Context, client dapr.Client)

type MoveOptions

type MoveOptions struct {
	Options
	AllowedCoordinates []battlefield.Coordinates
}

type NewGameRequest

type NewGameRequest struct {
	PlayerName string
}

type Options

type Options struct {
	GameID        string
	CurrentRound  int
	CurrentPhase  Phase
	CurrentUnitID string
}

type Phase

type Phase int
const (
	Movement Phase = iota
	Combat
	End
)

type Player

type Player int
const (
	PlayerA Player = iota
	PlayerB
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL