You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

45 lines
912 B

package main
import (
"log"
)
type deathmatch struct {
}
func (g *deathmatch) setup(gg *game) {
}
func (g *deathmatch) gameOver(gg *game) (bool, *GameOver) {
over := false
var stats *GameOver
if gg.players_remaining <= 1 && len(gg.players) > 1 {
gg.obstacles = GenerateObstacles(gg.obstacle_count, gg.width, gg.height)
log.Printf("game %s: game over", gg.id)
stats = NewGameOver()
for p := range gg.players {
gg.stats.Lock()
playerWin := false
for _, r := range p.Robots {
if r.Health > 0 {
log.Printf("Robot %v Survived", r.Id)
gg.stats.PlayerStats[p.Id].BotStats[r.Name].Wins += 1
stats.Winners = append(stats.Winners, r.Id)
playerWin = true
}
r.reset(gg)
}
if playerWin {
gg.stats.PlayerStats[p.Id].Wins += 1
}
gg.stats.Unlock()
}
over = true
}
return over, stats
}
func (g *deathmatch) tick(gg *game, payload *Boardstate) {
}