Methods
addGatherRates(gameState, rates)
Adds the gather rates of individual bases to a shared object.
Parameters:
Name | Type | Description |
---|---|---|
gameState |
Object | |
rates |
Object | The rates to add the gather rates to. |
- Source:
AddTCGatherer()
Add a gatherer to the turn cache for this supply.
- Source:
AddTCResGatherer()
The next two are to register that we assigned a gatherer to a resource this turn.
- Source:
addTerritoryIndexToBase() → {boolean}
- Source:
Returns:
- Whether the index was added to a base.
- Type
- boolean
assignEntity()
Assign an entity to the closest base.
Used by the starting strategy.
- Source:
assignGatherers()
Count gatherers returning resources in the number of gatherers of resourceSupplies
to prevent the AI always reassigning idle workers to these resourceSupplies (specially in naval maps).
- Source:
baseAtIndex(territoryIndex) → {number}
Parameters:
Name | Type | Description |
---|---|---|
territoryIndex |
number |
- Source:
Returns:
- The ID of the base at the given territory index.
- Type
- number
bulkPickWorkers()
returns an entity collection of workers through BaseManager.pickBuilders
TODO: when same accessIndex, sort by distance
- Source:
checkEvents()
TODO check if the new anchorless bases should be added to addBase
- Source:
createBase()
Create a new base in the baseManager:
If an existing one without anchor already exist, use it.
Otherwise create a new one.
TODO when buildings, criteria should depend on distance
- Source:
getBaseByID(baseID) → {Object}
Parameters:
Name | Type | Description |
---|---|---|
baseID |
number |
- Source:
Returns:
- The base corresponding to baseID.
- Type
- Object
GetCurrentGatherRates()
Returns the current gather rate
This is not per-se exact, it performs a few adjustments ad-hoc to account for travel distance, stuffs like that.
- Source:
getTotalResourceLevel() → {Object}
- Source:
Returns:
- Resources (estimation) still gatherable in our territory.
- Type
- Object
isResourceExhausted()
flag a resource as exhausted
- Source:
isResourceExhausted()
flag a resource as exhausted
- Source:
numActiveBases()
returns the number of bases with a cc
ActiveBases includes only those with a built cc
PotentialBases includes also those with a cc in construction
- Source:
postinit()
Initialization needed after deserialization (only called when deserialising).
- Source:
reassignTerritories()
Reassign territories when a base is going to be deleted
- Source:
removeBaseFromTerritoryIndex(territoryIndex)
Parameters:
Name | Type | Description |
---|---|---|
territoryIndex |
number |
- Source:
RemoveTCGatherer()
Remove a gatherer from the turn cache for this supply.
- Source:
update()
We will loop only on one active base per turn.
- Source:
updateBaseCache()
Updates the number of active and potential bases.
.potential {number} - Bases that may or may not still be a foundation.
.active {number} - Usable bases.
- Source: