chore: refactor structure

This commit is contained in:
Ilia Denisov
2025-11-21 21:40:15 +03:00
parent 126f381b04
commit 269de2184c
72 changed files with 512 additions and 393 deletions
+41
View File
@@ -0,0 +1,41 @@
package game
import "github.com/google/uuid"
type Race struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
Extinct bool `json:"extinct"`
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"`
Sciences []Science `json:"science,omitempty"`
ShipTypes []ShipType `json:"shipType,omitempty"`
}
type Relation string
const (
RelationWar Relation = "War"
RelationPeace Relation = "Peace"
)
type RaceRelation struct {
RaceID uuid.UUID `json:"raceId"`
Relation Relation `json:"relation"`
}
func (r Race) FlightDistance() float64 {
return r.Drive * 40
}
func (r Race) VisibilityDistance() float64 {
return r.Drive * 30
}