cmd: upgrade group
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user