wraith

package
v0.0.0-...-b9fa8cb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssembleConstructionCrewOrder

type AssembleConstructionCrewOrder struct {
	CorS     string // id of ship or colony to assemble in
	Quantity int
	// contains filtered or unexported fields
}

func (*AssembleConstructionCrewOrder) Execute

func (o *AssembleConstructionCrewOrder) Execute(e *Engine, p *Player) error

Execute assembles a construction crew on the colony or ship. Will fail if the colony or ship is not controlled by the player.

type AssembleFactoryGroupOrder

type AssembleFactoryGroupOrder struct {
	CorS     string // id of ship or colony to assemble in
	Quantity int
	Unit     string
	Product  string
	// contains filtered or unexported fields
}

func (*AssembleFactoryGroupOrder) Execute

func (o *AssembleFactoryGroupOrder) Execute(e *Engine, p *Player) error

Execute assembles a factory group on the colony or ship. Will fail if the colony or ship is not controlled by the player.

type AssembleFarmGroupOrder

type AssembleFarmGroupOrder struct {
	CorS     string // id of ship or colony to assemble in
	Quantity int
	Unit     string
	Product  string
	// contains filtered or unexported fields
}

func (*AssembleFarmGroupOrder) Execute

func (o *AssembleFarmGroupOrder) Execute(e *Engine, p *Player) error

Execute assembles a farm group on the colony or ship. Will fail if the colony or ship is not controlled by the player.

type AssembleMineGroupOrder

type AssembleMineGroupOrder struct {
	CorS     string // id of ship or colony to assemble in
	Quantity int
	Unit     string
	Deposit  string
	// contains filtered or unexported fields
}

func (*AssembleMineGroupOrder) Execute

func (o *AssembleMineGroupOrder) Execute(e *Engine, p *Player) error

Execute assembles a mine group on the colony or ship. Will fail if the colony or ship is not controlled by the player.

type AssembleSpyTeamOrder

type AssembleSpyTeamOrder struct {
	CorS     string // id of ship or colony to assemble in
	Quantity int
	// contains filtered or unexported fields
}

func (*AssembleSpyTeamOrder) Execute

func (o *AssembleSpyTeamOrder) Execute(e *Engine, p *Player) error

Execute assembles a spy team on the colony or ship. Will fail if the colony or ship is not controlled by the player.

type AssemblyPhaseOrder

type AssemblyPhaseOrder struct {
	ConstructionCrew *AssembleConstructionCrewOrder
	FactoryGroup     *AssembleFactoryGroupOrder
	FarmGroup        *AssembleFarmGroupOrder
	MiningGroup      *AssembleMineGroupOrder
	SpyTeam          *AssembleSpyTeamOrder
}

type ClusterList

type ClusterList []*ClusterListItem

func (ClusterList) Len

func (u ClusterList) Len() int

Len implements the sort.Sort interface

func (ClusterList) Less

func (u ClusterList) Less(i, j int) bool

Less implements the sort.Sort interface

func (ClusterList) Swap

func (u ClusterList) Swap(i, j int)

Swap implements the sort.Sort interface

type ClusterListItem

type ClusterListItem struct {
	X, Y, Z  int
	QtyStars int
	Distance float64
}

type ControlColonyOrder

type ControlColonyOrder struct {
	Id string // id of colony to take control of
}

func (*ControlColonyOrder) Execute

func (o *ControlColonyOrder) Execute(e *Engine, p *Player) error

Execute changes the controller of a colony to the player. Will fail if the colony is controlled by another player.

type ControlPhaseOrder

type ControlPhaseOrder struct {
	ControlColony *ControlColonyOrder
	ControlShip   *ControlShipOrder
	NameColony    *NameColonyOrder
	NameShip      *NameShipOrder
}

type ControlShipOrder

type ControlShipOrder struct {
	Id string // id of ship to take control of
}

func (*ControlShipOrder) Execute

func (o *ControlShipOrder) Execute(e *Engine, p *Player) error

Execute changes the controller of a ship to the player. Will fail if the ship is controlled by another player.

type Coordinates

type Coordinates struct {
	X int
	Y int
	Z int
}

Coordinates are the x,y,z coordinates of a system

func (Coordinates) String

func (c Coordinates) String() string

type CorS

type CorS struct {
	Id            int     // unique identifier
	Kind          string  // orbital, ship, or surface
	HullId        string  // S or C + MSN
	MSN           int     // manufacturer serial number; in game id for the colony or ship
	BuiltBy       *Nation // nation that originally built the colony or ship
	Name          string  // name of this colony or ship
	TechLevel     int     // tech level of this colony or ship
	ControlledBy  *Player // player that controls this colony or ship
	Planet        *Planet // planet the colony or ship is located at
	Hull          InventoryUnits
	Inventory     InventoryUnits
	Population    Population
	Pay           Pay
	Rations       Rations
	FactoryGroups FactoryGroups // list of the factory groups
	FarmGroups    FarmGroups    // list of the farm groups
	MineGroups    MineGroups    // list of the mine groups
	// contains filtered or unexported fields
}

CorS is a colony or ship

func (*CorS) InitializeInventory

func (cs *CorS) InitializeInventory()

func (*CorS) Log

func (cs *CorS) Log(format string, args ...interface{})

type CorSs

type CorSs []*CorS

func (CorSs) Len

func (c CorSs) Len() int

func (CorSs) Less

func (c CorSs) Less(i, j int) bool

func (CorSs) Swap

func (c CorSs) Swap(i, j int)

type Deposit

type Deposit struct {
	Id           int     // unique identifier
	No           int     // number of deposit on planet
	Product      *Unit   // fuel, gold, metallic, non-metallic
	InitialQty   int     // in metric tonnes
	RemainingQty int     // in metric tonnes
	YieldPct     float64 // percentage of each mass unit that yields units
	Planet       *Planet // planet deposit is on
	ControlledBy *CorS   // colony controlling this deposit
}

Deposit of fuel, gold, metal, or non-metals on the surface of a planet

type Deposits

type Deposits []*Deposit

func (Deposits) Len

func (d Deposits) Len() int

func (Deposits) Less

func (d Deposits) Less(i, j int) bool

func (Deposits) Swap

func (d Deposits) Swap(i, j int)

type Engine

type Engine struct {
	Version string
	Game    struct {
		Id   int
		Code string
		Name string
		Turn struct {
			Year    int
			Quarter int
			StartDt time.Time
			EndDt   time.Time
		}
	}
	Colonies        map[string]*CorS
	CorSById        map[int]*CorS
	Deposits        map[int]*Deposit
	FactoryGroups   map[int]*FactoryGroup
	FarmGroups      map[int]*FarmGroup
	MineGroups      map[int]*MineGroup
	Nations         map[int]*Nation
	Planets         map[int]*Planet
	Players         map[int]*Player
	Ships           map[string]*CorS
	Stars           map[int]*Star
	Systems         map[int]*System
	Units           map[int]*Unit
	UnitsFromString map[string]*Unit
	Seq             int
}

func (*Engine) ClusterScan

func (e *Engine) ClusterScan(origin Coordinates) ClusterList

func (*Engine) Execute

func (e *Engine) Execute(pos []*PhaseOrders, phases ...string) error

Execute runs all the orders in the list of phases. If the list is empty, no phases will run.

func (*Engine) ExecuteAssemblyPhase

func (e *Engine) ExecuteAssemblyPhase(pos []*PhaseOrders) (errs []error)

ExecuteAssemblyPhase runs all the orders in the assembly phase.

func (*Engine) ExecuteCombatPhase

func (e *Engine) ExecuteCombatPhase(pos []*PhaseOrders) (errs []error)

ExecuteCombatPhase runs all the orders in the combat phase.

func (*Engine) ExecuteControlPhase

func (e *Engine) ExecuteControlPhase(pos []*PhaseOrders) (errs []error)

ExecuteControlPhase runs all the orders in the control phase.

func (*Engine) ExecuteFactoryProductionPhase

func (e *Engine) ExecuteFactoryProductionPhase(pos []*PhaseOrders) (errs []error)

ExecuteFactoryProductionPhase runs all the orders in the factory production phase.

func (*Engine) ExecuteFarmProductionPhase

func (e *Engine) ExecuteFarmProductionPhase(pos []*PhaseOrders) (errs []error)

ExecuteFarmProductionPhase runs all the orders in the farm production phase.

func (*Engine) ExecuteFuelAllocationPhase

func (e *Engine) ExecuteFuelAllocationPhase(pos []*PhaseOrders) (errs []error)

ExecuteFuelAllocationPhase runs all the orders in the fuel allocation phase.

func (*Engine) ExecuteLaborAllocationPhase

func (e *Engine) ExecuteLaborAllocationPhase(pos []*PhaseOrders) (errs []error)

ExecuteLaborAllocationPhase runs all the orders in the fuel allocation phase.

func (*Engine) ExecuteLifeSupportPhase

func (e *Engine) ExecuteLifeSupportPhase(pos []*PhaseOrders) (errs []error)

ExecuteLifeSupportPhase runs all the orders in the life support phase.

func (*Engine) ExecuteMineProductionPhase

func (e *Engine) ExecuteMineProductionPhase(pos []*PhaseOrders) (errs []error)

ExecuteMineProductionPhase runs all the orders in the mine production phase.

func (*Engine) ExecuteRetoolPhase

func (e *Engine) ExecuteRetoolPhase(pos []*PhaseOrders) (errs []error)

ExecuteRetoolPhase runs all the orders in the retool phase.

func (*Engine) NextSeq

func (e *Engine) NextSeq() int

func (*Engine) Report

func (e *Engine) Report(w io.Writer, playerIds ...int) error

type FactoryGroup

type FactoryGroup struct {
	CorS     *CorS          // ship or colony that controls the group
	Id       int            // unique identifier
	No       int            // group number, range 1...255
	Product  *Unit          // unit being produced by the group
	Units    InventoryUnits // units assigned to the group
	StageQty [4]int         // assumes four turns to produce a single unit
}

FactoryGroup is a group of factories on a ship or colony. Each group is dedicated to manufacturing one type of unit.

type FactoryGroupUnits

type FactoryGroupUnits struct {
	Unit     *Unit // factory unit doing the manufacturing
	TotalQty int   // number of factory units in the group
}

FactoryGroupUnits is the number of factories working together in the group

type FactoryGroups

type FactoryGroups []*FactoryGroup

func (FactoryGroups) Len

func (f FactoryGroups) Len() int

func (FactoryGroups) Less

func (f FactoryGroups) Less(i, j int) bool

func (FactoryGroups) Swap

func (f FactoryGroups) Swap(i, j int)

type FarmGroup

type FarmGroup struct {
	CorS     *CorS          // ship or colony that controls the group
	Id       int            // unique identifier
	No       int            // group number, range 1...10
	Product  *Unit          // unit being produced by the group
	Units    InventoryUnits // units assigned to the group
	StageQty [4]int         // assumes four turns to produce a single unit
}

FarmGroup is a group of farm units on a ship or colony.

type FarmGroups

type FarmGroups []*FarmGroup

func (FarmGroups) Len

func (f FarmGroups) Len() int

func (FarmGroups) Less

func (f FarmGroups) Less(i, j int) bool

func (FarmGroups) Swap

func (f FarmGroups) Swap(i, j int)

type InventoryUnit

type InventoryUnit struct {
	Unit      *Unit
	ActiveQty int // number of active/operational units
	StowedQty int // number of units that are disassembled for storage
	// contains filtered or unexported fields
}

type InventoryUnits

type InventoryUnits []*InventoryUnit

func (InventoryUnits) Len

func (u InventoryUnits) Len() int

func (InventoryUnits) Less

func (u InventoryUnits) Less(i, j int) bool

func (InventoryUnits) Swap

func (u InventoryUnits) Swap(i, j int)

type MineGroup

type MineGroup struct {
	CorS     *CorS // colony that controls the group
	Id       int   // unique identifier
	No       int
	Deposit  *Deposit       // deposit being mined
	Unit     *InventoryUnit // mine units in the group
	StageQty [4]int         // assumes four turns to produce a single unit
}

MineGroup is a group of mines working a single deposit. All mine units in a group must be the same type and tech level.

type MineGroups

type MineGroups []*MineGroup

func (MineGroups) Len

func (m MineGroups) Len() int

func (MineGroups) Less

func (m MineGroups) Less(i, j int) bool

func (MineGroups) Swap

func (m MineGroups) Swap(i, j int)

type NameColonyOrder

type NameColonyOrder struct {
	Id   string // id of colony to name
	Name string // name to assign to colony
}

func (*NameColonyOrder) Execute

func (o *NameColonyOrder) Execute(e *Engine, p *Player) error

Execute changes the name of a colony controlled by a player. Will fail if the colony is not controlled by the player.

type NameShipOrder

type NameShipOrder struct {
	Id   string // id of ship to name
	Name string // name to assign to ship
}

func (*NameShipOrder) Execute

func (o *NameShipOrder) Execute(e *Engine, p *Player) error

Execute changes the name of a ship controlled by a player. Will fail if the ship is not controlled by the player.

type Nation

type Nation struct {
	Id                 int     // unique id for nation
	No                 int     // nation number, starts at 1
	Name               string  // unique name for this nation
	GovtName           string  // name of the government
	GovtKind           string  // kind of government
	HomePlanet         *Planet // nation's home planet
	ControlledBy       *Player // player controlling this nation
	Speciality         string  // nation's speciality for research
	TechLevel          int     // current tech level of the nation
	ResearchPointsPool int     // points in pool
	// not used currently
	Skills
}

Nation is a single nation in the game. The controller of the nation rules it, and may designate other players to control ships and colonies in the nation. These players are called viceroys or regents.

type Pay

type Pay struct {
	ProfessionalPct float64
	SoldierPct      float64
	UnskilledPct    float64
}

type PhaseOrders

type PhaseOrders struct {
	Player *Player
	// orders sorted by phase
	Combat      []*orders.Order
	SetUp       []*orders.Order
	Disassembly []*orders.Order
	Retool      []*RetoolPhaseOrder
	Transfer    []*orders.Order
	Assembly    []*AssemblyPhaseOrder
	Trade       []*orders.Order
	Survey      []*orders.Order
	Espionage   []*orders.Order
	Movement    []*orders.Order
	Draft       []*orders.Order
	Pay         []*orders.Order
	Ration      []*orders.Order
	Control     []*ControlPhaseOrder
}

type Planet

type Planet struct {
	Id             int // unique identifier
	System         *System
	Star           *Star
	OrbitNo        int    // 1...10
	Kind           string // asteroid belt, empty, gas giant, terrestrial
	HabitabilityNo int    // 0...25
	Colonies       CorSs
	Deposits       Deposits
	Ships          CorSs
}

Planet is an orbit. It may be empty.

type Player

type Player struct {
	Id        int     // unique id for a player
	UserId    int     // user that controls this player
	Name      string  // unique name for this player
	MemberOf  *Nation // nation the player is aligned with
	ReportsTo *Player // player that this player reports to
	Colonies  CorSs   // colonies controlled by this player
	Ships     CorSs   // ships controlled by this player
	Logger    struct {
		MP *message.Printer
		W  io.Writer
	}
}

func (*Player) Log

func (p *Player) Log(format string, args ...interface{})

type Population

type Population struct {
	ProfessionalQty        int
	SoldierQty             int
	UnskilledQty           int
	UnemployedQty          int
	ConstructionCrewQty    int
	SpyTeamQty             int
	RebelPct               float64
	BirthsPriorTurn        int
	NaturalDeathsPriorTurn int
}

func (Population) Total

func (p Population) Total() int

type Rations

type Rations struct {
	ProfessionalPct float64
	SoldierPct      float64
	UnskilledPct    float64
	UnemployedPct   float64
}

type RetoolFactoryGroupOrder

type RetoolFactoryGroupOrder struct {
	CorS     string // id of ship or colony to assemble in
	Quantity int
	Unit     string
	Product  string
}

type RetoolMiningGroupOrder

type RetoolMiningGroupOrder struct {
	CorS     string // id of ship or colony to assemble in
	Quantity int
	Unit     string
	Product  string
}

type RetoolPhaseOrder

type RetoolPhaseOrder struct {
	FactoryGroup *RetoolFactoryGroupOrder
	MiningGroup  *RetoolMiningGroupOrder
}

type Skills

type Skills struct {
	Biology       int
	Bureaucracy   int
	Gravitics     int
	LifeSupport   int
	Manufacturing int
	Military      int
	Mining        int
	Shields       int
}

type Star

type Star struct {
	Id       int // unique identifier
	System   *System
	Sequence string // A, B, etc
	Kind     string
	Planets  []*Planet
}

Star is a stellar system in the game. It contains zero or more planets, with each planet assigned to an orbit ranging from 1...10

type Stars

type Stars []*Star

func (Stars) Len

func (s Stars) Len() int

func (Stars) Less

func (s Stars) Less(i, j int) bool

func (Stars) Swap

func (s Stars) Swap(i, j int)

type System

type System struct {
	Id     int // unique identifier
	Coords Coordinates
	Stars  []*Star
}

type Unit

type Unit struct {
	Id                    int // unique identifier
	Kind                  string
	Code                  string
	TechLevel             int
	Name                  string
	Description           string
	MassPerUnit           float64 // mass (in metric tonnes) of a single unit
	VolumePerUnit         float64 // volume (in cubic meters) of a single unit
	Hudnut                bool    // if true, unit can be disassembled when stowed
	StowedVolumePerUnit   float64 // volume (in cubic meters) of a single unit when stowed
	FuelPerUnitPerTurn    float64
	MetsPerUnitPerTurn    float64
	NonMetsPerUnitPerTurn float64
}

Unit is a thing in the game.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL