Documentation ¶
Overview ¶
Code generated by gen_ids. DO NOT EDIT.
Index ¶
- Constants
- Variables
- func HasAttribute(attribute api.Attribute) func(u Unit) bool
- func IsGeyser(u Unit) bool
- func IsMineral(u Unit) bool
- func IsSelfType(t api.UnitTypeID) func(Unit) bool
- func IsType(t api.UnitTypeID) func(Unit) bool
- func SetGameVersion()
- type ActionErrorHandler
- type Actions
- func (a *Actions) Chat(msg string)
- func (a *Actions) ChatTeam(msg string)
- func (a *Actions) LogActionErrors()
- func (a *Actions) MoveCamera(pt api.Point2D)
- func (a *Actions) OnActionError(handler ActionErrorHandler)
- func (a *Actions) PrevActions() []*api.Action
- func (a *Actions) Send()
- func (a *Actions) UnitOrder(u Unit, ability api.AbilityID)
- func (a *Actions) UnitOrderPos(u Unit, ability api.AbilityID, target api.Point2D)
- func (a *Actions) UnitOrderTarget(u Unit, abil api.AbilityID, target Unit)
- func (a *Actions) UnitsOrder(units Units, ability api.AbilityID)
- func (a *Actions) UnitsOrderPos(units Units, ability api.AbilityID, target api.Point2D)
- func (a *Actions) UnitsOrderTarget(units Units, ability api.AbilityID, target Unit)
- type Bot
- type Builder
- func (b *Builder) BuildUnit(producer api.UnitTypeID, train api.AbilityID) bool
- func (b *Builder) BuildUnitAt(producer api.UnitTypeID, train api.AbilityID, pos api.Point2D) bool
- func (b *Builder) BuildUnitOn(producer api.UnitTypeID, train api.AbilityID, target Unit) bool
- func (b *Builder) BuildUnits(producer api.UnitTypeID, train api.AbilityID, count int) int
- func (b *Builder) ProductionCost(producerType api.UnitTypeID, train api.AbilityID) Cost
- type Cost
- type Player
- type Query
- func (q *Query) Execute() QueryResult
- func (q *Query) IgnoreResourceRequirements()
- func (q *Query) PathingFrom(start, end api.Point2D) int
- func (q *Query) Placement(ability api.AbilityID, pos api.Point2D) int
- func (q *Query) PlacementWithUnit(tag api.UnitTag, ability api.AbilityID, pos api.Point2D) int
- func (q *Query) UnitAbilities(tag api.UnitTag) int
- func (q *Query) UnitPathing(tag api.UnitTag, end api.Point2D) int
- type QueryResult
- func (q QueryResult) Abilities() []*api.ResponseQueryAvailableAbilities
- func (q QueryResult) AbilitiesQuery(i int) *api.RequestQueryAvailableAbilities
- func (q QueryResult) Pathing() []*api.ResponseQueryPathing
- func (q QueryResult) PathingQuery(i int) *api.RequestQueryPathing
- func (q QueryResult) PlacementQuery(i int) *api.RequestQueryBuildingPlacement
- func (q QueryResult) Placements() []*api.ResponseQueryBuildingPlacement
- type Unit
- func (u Unit) AirWeaponDamage() float32
- func (u Unit) AttackMove(pos api.Point2D, tollerance float32)
- func (u Unit) AttackTarget(target Unit)
- func (u Unit) BuildUnitAt(train api.AbilityID, pos api.Point2D) bool
- func (u Unit) BuildUnitOn(train api.AbilityID, target Unit) bool
- func (u Unit) CanBeTargeted() bool
- func (u Unit) CanOrder(abil api.AbilityID) bool
- func (u Unit) GroundWeaponDamage() float32
- func (u Unit) HasAttribute(attr api.Attribute) bool
- func (u Unit) HasBuff(buffID api.BuffID) bool
- func (u Unit) HasEnergy(energy float32) bool
- func (u Unit) IsBuilt() bool
- func (u Unit) IsCarryingResources() bool
- func (u Unit) IsGasBuilding() bool
- func (u Unit) IsGathering() bool
- func (u Unit) IsHidden() bool
- func (u Unit) IsIdle() bool
- func (u Unit) IsInWeaponsRange(target Unit, gap float32) bool
- func (u Unit) IsNil() bool
- func (u Unit) IsSnapshot() bool
- func (u Unit) IsStarted() bool
- func (u Unit) IsStructure() bool
- func (u Unit) IsTownHall() bool
- func (u Unit) IsVisible() bool
- func (u Unit) IsWorker() bool
- func (u Unit) Morph(train api.AbilityID) bool
- func (u Unit) MoveTo(pos api.Point2D, tollerance float32)
- func (u Unit) Order(ability api.AbilityID)
- func (u Unit) OrderPos(ability api.AbilityID, target api.Point2D)
- func (u Unit) OrderTarget(ability api.AbilityID, target Unit)
- func (u Unit) Pos2D() api.Point2D
- func (u Unit) WeaponDamage(target Unit) float32
- func (u Unit) WeaponRange(target Unit) float32
- type UnitContext
- type Units
- func (units Units) AttackMove(pos api.Point2D, tollerance float32)
- func (units Units) AttackTarget(target Unit)
- func (units Units) Cache() Units
- func (units Units) CanOrder(ability api.AbilityID) Units
- func (units Units) Center() api.Point2D
- func (units Units) Choose(filter func(Unit) bool) Units
- func (units Units) CloserThan(dist float32, pos api.Point2D) Units
- func (units Units) ClosestTo(pos api.Point2D) Unit
- func (units Units) Drop(filter func(Unit) bool) Units
- func (units Units) Each(f func(Unit))
- func (units Units) EachUntil(f func(Unit) bool) bool
- func (units Units) EachWhile(f func(Unit) bool) bool
- func (units Units) First() Unit
- func (units Units) HasBuff(buffID api.BuffID) Units
- func (units Units) HasEnergy(energy float32) Units
- func (units Units) IsBuilt() Units
- func (units Units) IsGasBuilding() Units
- func (units Units) IsIdle() Units
- func (units Units) IsStarted() Units
- func (units Units) IsTownHall() Units
- func (units Units) IsWorker() Units
- func (units Units) Len() int
- func (units Units) MoveTo(pos api.Point2D, tollerance float32)
- func (units Units) NoBuff(buffID api.BuffID) Units
- func (units Units) NotTagged(m map[api.UnitTag]bool) Units
- func (units Units) Order(ability api.AbilityID)
- func (units Units) OrderPos(ability api.AbilityID, target api.Point2D)
- func (units Units) OrderTarget(ability api.AbilityID, target Unit)
- func (units Units) Partition(filter func(Unit) bool) (choose Units, drop Units)
- func (units Units) Slice() []Unit
- func (units Units) Tagged(m map[api.UnitTag]bool) Units
- func (units Units) Tags() []api.UnitTag
Constants ¶
const ( GameVersion = "4.11.4.78285" DataVersion = "69493AFAB5C7B45DDB2F3442FD60F0CF" DataBuild = 78285 BaseBuild = 78285 )
Variables ¶
var IsGasBuilding = isUnitTypeInMap(map[api.UnitTypeID]struct{}{ unit.Protoss_Assimilator: {}, unit.Terran_Refinery: {}, unit.Zerg_Extractor: {}, })
IsGasBuilding ...
var IsStructure = HasAttribute(api.Attribute_Structure)
IsStructure ...
var IsTownHall = isUnitTypeInMap(map[api.UnitTypeID]struct{}{ unit.Protoss_Nexus: {}, unit.Terran_CommandCenter: {}, unit.Terran_CommandCenterFlying: {}, unit.Terran_OrbitalCommand: {}, unit.Terran_OrbitalCommandFlying: {}, unit.Zerg_Hatchery: {}, unit.Zerg_Lair: {}, unit.Zerg_Hive: {}, })
IsTownHall ...
var IsWorker = isUnitTypeInMap(map[api.UnitTypeID]struct{}{ unit.Protoss_Probe: {}, unit.Terran_SCV: {}, unit.Terran_MULE: {}, unit.Zerg_Drone: {}, unit.Zerg_DroneBurrowed: {}, })
IsWorker ...
Functions ¶
func SetGameVersion ¶ added in v0.2.0
func SetGameVersion()
SetGameVersion sets the default base build and data version to the values last used to generate IDs.
Types ¶
type ActionErrorHandler ¶
type ActionErrorHandler func(action *api.Action, result api.ActionResult)
ActionErrorHandler is the handler function type for action errors.
type Actions ¶
type Actions struct {
// contains filtered or unexported fields
}
Actions provides convenience methods for queueing actions to be sent in a batch.
func NewActions ¶
NewActions creates a new Actions manager. It's Send() method is registered to be automatcially called before each client Step().
func (*Actions) LogActionErrors ¶
func (a *Actions) LogActionErrors()
LogActionErrors registers an error handler that will log the error.
func (*Actions) MoveCamera ¶
MoveCamera repositions the camera to center on the target point.
func (*Actions) OnActionError ¶
func (a *Actions) OnActionError(handler ActionErrorHandler)
OnActionError sets a handler function that will be called whenever an action errors.
func (*Actions) PrevActions ¶
PrevActions returns the actions that were sent on the last call to Send.
func (*Actions) Send ¶
func (a *Actions) Send()
Send is called automatically to submit queued actions before each Step(). It may also be called manually at any point to send all queued actions immediately.
func (*Actions) UnitOrderPos ¶
UnitOrderPos orders a unit to use an ability at a target location.
func (*Actions) UnitOrderTarget ¶
UnitOrderTarget orders a unit to use an ability on a target unit.
func (*Actions) UnitsOrder ¶
UnitsOrder orders units to all use an ability.
func (*Actions) UnitsOrderPos ¶
UnitsOrderPos orders units to all use an ability at a target location.
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder provides operations to make building/morphing/training/warping units easier.
func NewBuilder ¶
func NewBuilder(info client.AgentInfo, player *Player, units *UnitContext) *Builder
NewBuilder creates a new Builder and registers it to fix FoodUsed rounding for zerg.
func (*Builder) BuildUnit ¶
BuildUnit commands an available producer to use the train ability to build/morph/train/warp a unit. If the food, mineral, and vespene requirements are not met or no producer was found it does nothing and returns false.
func (*Builder) BuildUnitAt ¶
BuildUnitAt commands an available producer to use the train ability to build/morph/train/warp a unit at the given location. If the food, mineral, and vespene requirements are not met or no producer was found it does nothing and returns false.
func (*Builder) BuildUnitOn ¶
BuildUnitOn commands an available producer to use the train ability to build/morph/train/warp a unit on the given target. If the food, mineral, and vespene requirements are not met or no producer was found it does nothing and returns false.
func (*Builder) BuildUnits ¶
BuildUnits commands available producers to use the train ability to build/morph/train/warp count units. Returns the number of units actually ordered based on producer, food, mineral, and vespene availability.
func (*Builder) ProductionCost ¶
ProductionCost computes the Cost for producerType to train once.
type Cost ¶
type Cost struct {
Minerals, Vespene, Food uint32
}
Cost represents the full cost of an ability.
type Player ¶
type Player struct { api.PlayerCommon api.PlayerInfo OpponentID api.PlayerID OpponentRace api.Race }
Player ...
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query ...
func (*Query) Execute ¶
func (q *Query) Execute() QueryResult
Execute runs the query and returns the result
func (*Query) IgnoreResourceRequirements ¶
func (q *Query) IgnoreResourceRequirements()
IgnoreResourceRequirements ...
func (*Query) PlacementWithUnit ¶
PlacementWithUnit ...
type QueryResult ¶
type QueryResult struct {
// contains filtered or unexported fields
}
QueryResult ...
func (QueryResult) Abilities ¶
func (q QueryResult) Abilities() []*api.ResponseQueryAvailableAbilities
Abilities ...
func (QueryResult) AbilitiesQuery ¶
func (q QueryResult) AbilitiesQuery(i int) *api.RequestQueryAvailableAbilities
AbilitiesQuery ...
func (QueryResult) PathingQuery ¶
func (q QueryResult) PathingQuery(i int) *api.RequestQueryPathing
PathingQuery ...
func (QueryResult) PlacementQuery ¶
func (q QueryResult) PlacementQuery(i int) *api.RequestQueryBuildingPlacement
PlacementQuery ...
func (QueryResult) Placements ¶
func (q QueryResult) Placements() []*api.ResponseQueryBuildingPlacement
Placements ...
type Unit ¶
type Unit struct { *api.UnitTypeData *api.Unit // contains filtered or unexported fields }
Unit combines the api Unit with it's UnitTypeData and adds some additional convenience methods.
func (Unit) AirWeaponDamage ¶
AirWeaponDamage returns damage per shot the unit can do to air targets.
func (Unit) AttackMove ¶
AttackMove issues an attack order if the unit isn't already attacking within tollerance of pos.
func (Unit) AttackTarget ¶
AttackTarget issues an attack order if the unit isn't already attacking the target.
func (Unit) BuildUnitAt ¶
BuildUnitAt ...
func (Unit) BuildUnitOn ¶
BuildUnitOn ...
func (Unit) CanBeTargeted ¶
CanBeTargeted returns true if the unit type can be targeted for attacks.
func (Unit) GroundWeaponDamage ¶
GroundWeaponDamage returns damage per shot the unit can do to ground targets.
func (Unit) HasAttribute ¶
HasAttribute checks if this unit has the specified attribute.
func (Unit) IsCarryingResources ¶
IsCarryingResources returns true if the unit is carrying minerals or gas.
func (Unit) IsGasBuilding ¶
IsGasBuilding returns true if the unit is an Assimilator/Refinery/Extractory.
func (Unit) IsGathering ¶
IsGathering returns true if the unit is currently gathering.
func (Unit) IsInWeaponsRange ¶
IsInWeaponsRange returns true if the unit is within weapons range of the target.
func (Unit) IsSnapshot ¶
IsSnapshot checks if DisplayType is Snapshot.
func (Unit) IsStarted ¶
IsStarted returns true if the unit has started building (is not ghost placement).
func (Unit) IsStructure ¶
IsStructure checks if the unit is a building (has the Structure attribute).
func (Unit) IsTownHall ¶
IsTownHall returns true if the unit is a Nexus/CC/OC/PF/Hatch/Lair/Hive.
func (Unit) MoveTo ¶
MoveTo issues a move order if the unit isn't already moving to or within tollerance of pos.
func (Unit) OrderTarget ¶
OrderTarget ...
func (Unit) WeaponDamage ¶
WeaponDamage returns damage per shot the unit can do to the given target.
func (Unit) WeaponRange ¶
WeaponRange returns the maximum range to attack the target from. If the result is negative the target cannot be attacked.
type UnitContext ¶
type UnitContext struct { Self self Ally ally Enemy enemy Neutral neutral // contains filtered or unexported fields }
UnitContext stores shared state about units from an observation and provides filtered access to those units.
func NewUnitContext ¶
func NewUnitContext(info client.AgentInfo, bot *Bot) *UnitContext
NewUnitContext creates a new context and registers it to update after each step.
func (*UnitContext) AllUnits ¶
func (ctx *UnitContext) AllUnits() Units
AllUnits returns all units from the most recent observation.
func (*UnitContext) UnitByTag ¶
func (ctx *UnitContext) UnitByTag(tag api.UnitTag) Unit
UnitByTag returns a the unit with the given tag if it was in included in the last observation.
func (*UnitContext) WasObserved ¶
func (ctx *UnitContext) WasObserved(tag api.UnitTag) bool
WasObserved returns true if a unit with the given tag was inlucded in the last observation.
type Units ¶
type Units struct {
// contains filtered or unexported fields
}
Units ...
func (Units) AttackMove ¶
AttackMove issues an attack order to any unit that isn't already attacking within tollerance of pos.
func (Units) AttackTarget ¶
AttackTarget issues an attack order to any unit that isn't already attacking the target.
func (Units) Cache ¶
Cache applies any filtering and returns a struct that owns the underlying Unit slice.
func (Units) CloserThan ¶
CloserThan returns all units less than or equal to dist from pos.
func (Units) EachUntil ¶
EachUntil calls f until it returns true or runs out of elements. Returns the last result of f (true on early return).
func (Units) EachWhile ¶
EachWhile calls f until it returns false or runs out of elements. Returns the last result of f (false on early return).
func (Units) First ¶
First returns the first unit in the list or a Unit.IsNil() if the list is empty.
func (Units) MoveTo ¶
MoveTo issues a move order to any unit that isn't already moving to or within tollerance of pos.
func (Units) OrderTarget ¶
OrderTarget ...
func (Units) Partition ¶
Partition splits the units into ones that filter is true for and ones that filter is false for.