Methods
AddResource(type, amount)
Add resource of specified type to player.
Parameters:
Name | Type | Description |
---|---|---|
type |
string | Generic type of resource. |
amount |
number | Amount of resource, which should be added. |
AddResourceGatherer(type)
Parameters:
Name | Type | Description |
---|---|---|
type |
string | The generic type of resource to add the gatherer for. |
AddResources()
Add resources to player.
IsActive() → {boolean}
Returns:
-
- Type
- boolean
IsAlly()
Check if given player is our ally.
IsEnemy()
Check if given player is our enemy
IsExclusiveAlly()
Check if given player is our ally excluding ourself
IsExclusiveMutualAlly()
Check if given player is our ally, and we are its ally, excluding ourself
IsMutualAlly()
Check if given player is our ally, and we are its ally
IsNeutral()
Check if given player is neutral
OnGlobalInitGame()
Do some map dependant initializations
OnGlobalOwnershipChanged()
Keep track of population effects of all entities that
become owned or unowned by this player.
RemoveResourceGatherer(type)
Parameters:
Name | Type | Description |
---|---|---|
type |
string | The generic type of resource to remove the gatherer from. |
Serialize()
Don't serialize diplomacyColor or displayDiplomacyColor since they're modified by the GUI.
SetState(newState, message)
Parameters:
Name | Type | Description |
---|---|---|
newState |
string | Either "defeated" or "won". |
message |
string | undefined | A string to be shown in chat, for example markForTranslation("%(player)s has been defeated (failed objective)."). If it is undefined, the caller MUST send that GUI notification manually. |