Ejemplo n.º 1
0
// FoundCorporation founds a new corporation
func (g *Game) FoundCorporation(corp interfaces.Corporation) error {
	if g.stateMachine.CurrentStateName() != interfaces.FoundCorpStateName {
		return errors.New(ActionNotAllowed)
	}
	if corp.IsActive() {
		return errors.New(CorporationAlreadyOnBoard)
	}
	g.board.SetOwner(corp, g.newCorpTiles)
	corp.Grow(len(g.newCorpTiles))
	g.newCorpTiles = []interfaces.Tile{}
	g.getFounderStockShare(g.CurrentPlayer(), corp)
	g.stateMachine.ToBuyStock()
	return nil
}
Ejemplo n.º 2
0
// Makes a corporation grow with the passed tiles
func (g *Game) growCorporation(corp interfaces.Corporation, tiles []interfaces.Tile) {
	g.board.SetOwner(corp, tiles)
	corp.Grow(len(tiles))
}