コード例 #1
0
ファイル: game.go プロジェクト: svera/acquire
// Receive a free stock share from a recently founded corporation, if it has
// remaining shares available
// TODO this should trigger an event warning that no founder stock share will be given
// of the founded corporation has no stock shares left
func (g *Game) getFounderStockShare(pl interfaces.Player, corp interfaces.Corporation) {
	if corp.Stock() > 0 {
		corp.RemoveStock(1)
		pl.AddShares(corp, 1)
	}
}
コード例 #2
0
ファイル: game_buy_stock.go プロジェクト: svera/acquire
func (g *Game) buy(corp interfaces.Corporation, amount int) {
	corp.RemoveStock(amount)
	g.CurrentPlayer().
		AddShares(corp, amount).
		RemoveCash(corp.StockPrice() * amount)
}