cmd: upgrade group

This commit is contained in:
Ilia Denisov
2026-01-04 19:22:06 +02:00
parent 6157c07a35
commit c6e1cb5cdf
17 changed files with 918 additions and 245 deletions
+15 -7
View File
@@ -1,6 +1,8 @@
package game
import "github.com/google/uuid"
import (
"github.com/google/uuid"
)
type Race struct {
ID uuid.UUID `json:"id"`
@@ -10,10 +12,7 @@ type Race struct {
Vote uuid.UUID `json:"vote"`
Relations []RaceRelation `json:"relations"`
Drive float64 `json:"drive"`
Weapons float64 `json:"weapons"`
Shields float64 `json:"shields"`
Cargo float64 `json:"cargo"`
Tech TechSet `json:"tech"`
Sciences []Science `json:"science,omitempty"`
@@ -32,10 +31,19 @@ type RaceRelation struct {
Relation Relation `json:"relation"`
}
func (r Race) TechLevel(t Tech) float64 {
return r.Tech.Value(t)
}
// TODO: refactor to separate method with *Race as parameter
func (r *Race) SetTechLevel(t Tech, v float64) {
r.Tech = r.Tech.Set(t, v)
}
func (r Race) FlightDistance() float64 {
return r.Drive * 40
return r.TechLevel(TechDrive) * 40
}
func (r Race) VisibilityDistance() float64 {
return r.Drive * 30
return r.TechLevel(TechDrive) * 30
}