79 lines
1.8 KiB
Go
79 lines
1.8 KiB
Go
package engine
|
|
|
|
// Game is a game of MLP:CCG
|
|
type Game struct {
|
|
Players []*Player
|
|
Board Board
|
|
Turns []*Turn
|
|
CurrentTurn *Turn
|
|
}
|
|
|
|
// Action is an action that can be taken by players
|
|
type Action struct {
|
|
Type ActionType
|
|
}
|
|
|
|
// ActionType is a type of action players can take
|
|
type ActionType string
|
|
|
|
// All actions
|
|
const (
|
|
ActDraw ActionType = "draw"
|
|
ActPlay ActionType = "play a card"
|
|
ActActivate ActionType = "activate ability"
|
|
ActMove ActionType = "move character"
|
|
ActRally ActionType = "rally friend"
|
|
)
|
|
|
|
// Turn is a turn in a game
|
|
type Turn struct {
|
|
ActionLog []Action
|
|
Player *Player
|
|
Phase Phase
|
|
Step PhaseStep
|
|
}
|
|
|
|
// Phase is a turn phase
|
|
type Phase string
|
|
|
|
// All phases
|
|
const (
|
|
PhaseReady = "ready phase"
|
|
PhaseTroublemaker = "troublemaker phase"
|
|
PhaseMain = "main phase"
|
|
PhaseScore = "score phase"
|
|
PhaseEnd = "end phase"
|
|
)
|
|
|
|
// PhaseStep is a step in a phase
|
|
type PhaseStep string
|
|
|
|
// All steps
|
|
const (
|
|
// Ready phase steps
|
|
ReadyStep PhaseStep = "ready step"
|
|
ActionStep PhaseStep = "action step"
|
|
DrawStep PhaseStep = "draw step"
|
|
|
|
// Troublemaker phase steps
|
|
UncoverStep PhaseStep = "uncover step"
|
|
ChallengeStep PhaseStep = "challenge step"
|
|
|
|
// Score phase steps
|
|
ConfrontStep PhaseStep = "confront step"
|
|
FaceoffStep PhaseStep = "faceoff step"
|
|
SolveStep PhaseStep = "solve step"
|
|
|
|
// End phase steps
|
|
EndOfTurnStep PhaseStep = "end of turn step"
|
|
WrapUpStep PhaseStep = "wrap up step"
|
|
)
|
|
|
|
// PhaseStepList lists all the steps of each phase
|
|
var PhaseStepList = map[Phase][]PhaseStep{
|
|
PhaseReady: []PhaseStep{ReadyStep, ActionStep, DrawStep},
|
|
PhaseTroublemaker: []PhaseStep{UncoverStep, ChallengeStep},
|
|
PhaseMain: []PhaseStep{},
|
|
PhaseScore: []PhaseStep{ConfrontStep, FaceoffStep, SolveStep},
|
|
PhaseEnd: []PhaseStep{EndOfTurnStep, WrapUpStep},
|
|
}
|