Class: MapPlayer#

Hierarchy#

  • Handle<player>

    ↳ MapPlayer

Properties#

handle#

• Readonly handle: player

Inherited from: Handle.handle

Defined in: handles/handle.ts:6

Accessors#

color#

color(): playercolor

Returns: playercolor

Defined in: handles/player.ts:20

color(color: playercolor): void

Parameters:#

NameType
colorplayercolor

Returns: void

Defined in: handles/player.ts:16


controller#

controller(): mapcontrol

Returns: mapcontrol

Defined in: handles/player.ts:24


handicap#

handicap(): number

Returns: number

Defined in: handles/player.ts:28

handicap(handicap: number): void

Parameters:#

NameType
handicapnumber

Returns: void

Defined in: handles/player.ts:32


handicapXp#

handicapXp(): number

Returns: number

Defined in: handles/player.ts:36

handicapXp(handicap: number): void

Parameters:#

NameType
handicapnumber

Returns: void

Defined in: handles/player.ts:40


id#

id(): number

Returns: number

Defined in: handles/player.ts:44


name#

name(): string

Returns: string

Defined in: handles/player.ts:48

name(value: string): void

Parameters:#

NameType
valuestring

Returns: void

Defined in: handles/player.ts:52


race#

race(): race

Returns: race

Defined in: handles/player.ts:56


slotState#

slotState(): playerslotstate

Returns: playerslotstate

Defined in: handles/player.ts:60


startLocation#

startLocation(): number

Returns: number

Defined in: handles/player.ts:64


startLocationPoint#

startLocationPoint(): location

Returns: location

Defined in: handles/player.ts:76


startLocationX#

startLocationX(): number

Returns: number

Defined in: handles/player.ts:68


startLocationY#

startLocationY(): number

Returns: number

Defined in: handles/player.ts:72


team#

team(): number

Returns: number

Defined in: handles/player.ts:80


townHallCount#

townHallCount(): number

Returns: number

Defined in: handles/player.ts:84

Methods#

addTechResearched#

addTechResearched(techId: number, levels: number): void

In upgrades that have multiple levels, it will research the upgrade by the number of levels specified.

Parameters:#

NameTypeDescription
techIdnumberThe four digit rawcode ID of the upgrade.
levelsnumberThe number of levels to add to the current research level of the upgrade.

Returns: void

Defined in: handles/player.ts:93


cacheHeroData#

cacheHeroData(): void

Used to store hero level data for the scorescreen, before units are moved to neutral passive in melee games.

Returns: void

Defined in: handles/player.ts:104


compareAlliance#

compareAlliance(otherPlayer: MapPlayer, whichAllianceSetting: alliancetype): boolean

Parameters:#

NameType
otherPlayerMapPlayer
whichAllianceSettingalliancetype

Returns: boolean

Defined in: handles/player.ts:108


coordsFogged#

coordsFogged(x: number, y: number): boolean

Parameters:#

NameType
xnumber
ynumber

Returns: boolean

Defined in: handles/player.ts:112


coordsMasked#

coordsMasked(x: number, y: number): boolean

Parameters:#

NameType
xnumber
ynumber

Returns: boolean

Defined in: handles/player.ts:116


coordsVisible#

coordsVisible(x: number, y: number): boolean

Parameters:#

NameType
xnumber
ynumber

Returns: boolean

Defined in: handles/player.ts:120


cripple#

cripple(toWhichPlayers: Force, flag: boolean): void

Reveals a player's remaining buildings to a force. The black mask over the buildings will be removed as if the territory had been discovered

note his function will not check whether the player has a town hall before revealing.

Parameters:#

NameTypeDescription
toWhichPlayersForceThe players who will see whichPlayer's buildings.
flagbooleanIf true, the buildings will be revealed. If false, the buildings will not be revealed. Note that if you set it to false, it will not hide the buildings with a black mask.

Returns: void

Defined in: handles/player.ts:132


decTechResearched#

decTechResearched(techId: number, levels: number): void

Parameters:#

NameType
techIdnumber
levelsnumber

Returns: void

Defined in: handles/player.ts:97


getScore#

getScore(whichPlayerScore: playerscore): number

Parameters:#

NameType
whichPlayerScoreplayerscore

Returns: number

Defined in: handles/player.ts:136


getState#

getState(whichPlayerState: playerstate): number

Parameters:#

NameType
whichPlayerStateplayerstate

Returns: number

Defined in: handles/player.ts:140


getStructureCount#

getStructureCount(includeIncomplete: boolean): number

Parameters:#

NameType
includeIncompleteboolean

Returns: number

Defined in: handles/player.ts:144


getTaxRate#

getTaxRate(otherPlayer: player, whichResource: playerstate): number

Parameters:#

NameType
otherPlayerplayer
whichResourceplayerstate

Returns: number

Defined in: handles/player.ts:148


getTechCount#

getTechCount(techId: number, specificonly: boolean): number

Parameters:#

NameType
techIdnumber
specificonlyboolean

Returns: number

Defined in: handles/player.ts:152


getTechMaxAllowed#

getTechMaxAllowed(techId: number): number

Parameters:#

NameType
techIdnumber

Returns: number

Defined in: handles/player.ts:156


getTechResearched#

getTechResearched(techId: number, specificonly: boolean): boolean

Parameters:#

NameType
techIdnumber
specificonlyboolean

Returns: boolean

Defined in: handles/player.ts:160


getUnitCount#

getUnitCount(includeIncomplete: boolean): number

Parameters:#

NameType
includeIncompleteboolean

Returns: number

Defined in: handles/player.ts:164


getUnitCountByType#

getUnitCountByType(unitName: string, includeIncomplete: boolean, includeUpgrades: boolean): number

Parameters:#

NameType
unitNamestring
includeIncompleteboolean
includeUpgradesboolean

Returns: number

Defined in: handles/player.ts:168


inForce#

inForce(whichForce: Force): boolean

Parameters:#

NameType
whichForceForce

Returns: boolean

Defined in: handles/player.ts:172


isLocal#

isLocal(): boolean

Returns: boolean

Defined in: handles/player.ts:176


isObserver#

isObserver(): boolean

Returns: boolean

Defined in: handles/player.ts:180


isPlayerAlly#

isPlayerAlly(otherPlayer: MapPlayer): boolean

Parameters:#

NameType
otherPlayerMapPlayer

Returns: boolean

Defined in: handles/player.ts:184


isPlayerEnemy#

isPlayerEnemy(otherPlayer: MapPlayer): boolean

Parameters:#

NameType
otherPlayerMapPlayer

Returns: boolean

Defined in: handles/player.ts:188


isRacePrefSet#

isRacePrefSet(pref: racepreference): boolean

Parameters:#

NameType
prefracepreference

Returns: boolean

Defined in: handles/player.ts:192


isSelectable#

isSelectable(): boolean

Returns: boolean

Defined in: handles/player.ts:196


pointFogged#

pointFogged(whichPoint: Point): boolean

Parameters:#

NameType
whichPointPoint

Returns: boolean

Defined in: handles/player.ts:200


pointMasked#

pointMasked(whichPoint: Point): boolean

Parameters:#

NameType
whichPointPoint

Returns: boolean

Defined in: handles/player.ts:204


pointVisible#

pointVisible(whichPoint: Point): boolean

Parameters:#

NameType
whichPointPoint

Returns: boolean

Defined in: handles/player.ts:208


remove#

remove(gameResult: playergameresult): void

Parameters:#

NameType
gameResultplayergameresult

Returns: void

Defined in: handles/player.ts:212


removeAllGuardPositions#

removeAllGuardPositions(): void

Returns: void

Defined in: handles/player.ts:216


setAbilityAvailable#

setAbilityAvailable(abilId: number, avail: boolean): void

Parameters:#

NameType
abilIdnumber
availboolean

Returns: void

Defined in: handles/player.ts:220


setAlliance#

setAlliance(otherPlayer: MapPlayer, whichAllianceSetting: alliancetype, value: boolean): void

Parameters:#

NameType
otherPlayerMapPlayer
whichAllianceSettingalliancetype
valueboolean

Returns: void

Defined in: handles/player.ts:224


setOnScoreScreen#

setOnScoreScreen(flag: boolean): void

Parameters:#

NameType
flagboolean

Returns: void

Defined in: handles/player.ts:228


setState#

setState(whichPlayerState: playerstate, value: number): void

Parameters:#

NameType
whichPlayerStateplayerstate
valuenumber

Returns: void

Defined in: handles/player.ts:232


setTaxRate#

setTaxRate(otherPlayer: MapPlayer, whichResource: playerstate, rate: number): void

Parameters:#

NameType
otherPlayerMapPlayer
whichResourceplayerstate
ratenumber

Returns: void

Defined in: handles/player.ts:236


setTechMaxAllowed#

setTechMaxAllowed(techId: number, maximum: number): void

Parameters:#

NameType
techIdnumber
maximumnumber

Returns: void

Defined in: handles/player.ts:240


setTechResearched#

setTechResearched(techId: number, setToLevel: number): void

Parameters:#

NameType
techIdnumber
setToLevelnumber

Returns: void

Defined in: handles/player.ts:244


setUnitsOwner#

setUnitsOwner(newOwner: number): void

Parameters:#

NameType
newOwnernumber

Returns: void

Defined in: handles/player.ts:248


fromEnum#

static fromEnum(): MapPlayer

Returns: MapPlayer

Defined in: handles/player.ts:252


fromEvent#

static fromEvent(): MapPlayer

Returns: MapPlayer

Defined in: handles/player.ts:256


fromFilter#

static fromFilter(): MapPlayer

Returns: MapPlayer

Defined in: handles/player.ts:260


fromHandle#

static fromHandle(handle: player): MapPlayer

Parameters:#

NameType
handleplayer

Returns: MapPlayer

Defined in: handles/player.ts:264


fromIndex#

static fromIndex(index: number): MapPlayer

Parameters:#

NameType
indexnumber

Returns: MapPlayer

Defined in: handles/player.ts:268


fromLocal#

static fromLocal(): MapPlayer

async

Returns: MapPlayer

Defined in: handles/player.ts:275