Games\Empires\Game.js
GamesByEmail
Object
All Implemented Interfaces:
GamesByEmail.Empire
implementsFoundation.Class
Constructor Summary |
|
Method Summary | |
|
|
|
//Naval territories are assigned to an empire only once the empire expands
//to a land adjacent to the sea territory. Also, the territory must be further
//checked as boats may no longer be there due to reallocation card.
|
|
|
|
|
|
|
|
|
|
//treat this as private
|
|
//don't pass in a territory that isn't in this empire!
//decrements iMonuments.
|
|
//Adds input territory to this empire.
|
|
|
|
|
|
//aCardsInPlay is an array with up to 2 cardIds.
|
|
|
|
|
|
//true if territory borders this empire.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static |
// Static methods and properties.
|
static |
//returns a link object ( has .name + .url ), OR null if none found.
|
|
//calculates & returns the bonus, but doesn't alter class state
//(called from log)
|
|
|
|
|
|
|
|
|
|
|
static |
//style: optional param to set the style of the anchor
//postconditions: You add "" to close off the anchor.
|
static |
|
static |
//Called from empiresDealer to EmpiresList Card
|
|
//returns territory id or NONE
|
|
/*
CURRENT EMPIRE BIT-ENCODING SCHEME
index ( -1 to 69 ) 7Bits
remainingArmies (0-32) 5bits
card1(cardId) (-1-41) 6Bits
card2(cardId) (-1-41) 6Bits
forts (0-2) 3bits
coins (0-32) 5bits (32bits of fixed length data)
territories: [0 to n]7Bits*n.
0-n territories.
an array of integers 13-128 each.(0-115)
Use an offset of 13 to map 0 to Albion.
*/
//Convert class state to string and return it
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//callImportData on this to import empire data
//if deriving from Info, remove this method.
|
|
|
|
|
|
|
|
//Call when empire loses a battle.
|
|
|
|
|
|
|
|
//p:private to this class. Only call during empire placement.
// Displays boat icons on all oceans and seas for empire.
|
|
|
|
|
|
|
|
//default is to throb or dethrob whole empire using bShow.
// bVacantMonuments: opt: default is false. When true, only throb if the
// land has no monument.
// bResourcesOnly: opt: default to fale. When true, only throb territories
// with resources (and probably also without monuments)
|
|
|
|
|
|
|
|
|
|
|
|
//preconditions: Data has been imported for this empire.
|
|
|
|
//Returns Have or Has depending on if Empire Title is plural
|
|
|
|
|
|
|
|
|
Methods inherited from Foundation.Class |
getTypePath , isInstanceOf |
Constructor Detail |
GamesByEmail.Empire(game)
game -
Method Detail |
addAlliesBonus()
addAnyAdjacentNavalTerritories()
//Naval territories are assigned to an empire only once the empire expands //to a land adjacent to the sea territory. Also, the territory must be further //checked as boats may no longer be there due to reallocation card.
addAnyNewTerritoriesToThrobList()
addCivilServiceBonus()
addCoins(iCoins)
iCoins -
addEngineeringBonus()
addFortTo()
//treat this as private
addMonument()
//don't pass in a territory that isn't in this empire! //decrements iMonuments.
addToEmpire()
//Adds input territory to this empire.
addToNaval(territoryIndex)
territoryIndex -
addToTerritories(territoryId)
territoryId -
assignCards()
//aCardsInPlay is an array with up to 2 cardIds.
blinkTerritoriesWhichCanAttack(territory)
territory -
blurt()
bordersActiveEmpire()
//true if territory borders this empire.
canAttack(territory)
territory -
canAttackFromMultipleLocations(territory)
territory -
canBuildFort()
canStillExpand()
demoteJihad()
discard(iCardId)
iCardId -
dispose()
dispose
in class Class
doesCapitalHaveAMonument()
static empireToString()
// Static methods and properties.
static getALink()
//returns a link object ( has .name + .url ), OR null if none found.
getAlliesBonus()
//calculates & returns the bonus, but doesn't alter class state //(called from log)
getAttackFromTerritory(territory)
territory -
getCapitalID()
getCivilServiceBonus()
getEngineeringBonus()
getEpoch()
static getLink()
//style: optional param to set the style of the anchor //postconditions: You add "" to close off the anchor.
static getNavalString(empireId,
game)
empireId -
game -
static getNavalTerritoriesString()
//Called from empiresDealer to EmpiresList Card
getNextCapitalWithoutMonument()
//returns territory id or NONE
getString()
/* CURRENT EMPIRE BIT-ENCODING SCHEME index ( -1 to 69 ) 7Bits remainingArmies (0-32) 5bits card1(cardId) (-1-41) 6Bits card2(cardId) (-1-41) 6Bits forts (0-2) 3bits coins (0-32) 5bits (32bits of fixed length data) territories: [0 to n]7Bits*n. 0-n territories. an array of integers 13-128 each.(0-115) Use an offset of 13 to map 0 to Albion. */ //Convert class state to string and return it
hasACapital()
hasCard(iCard)
iCard -
hasNavalIn(territory)
territory -
hasResourceTerritoriesWithoutMonuments()
hasSpaceForMonument()
hasTerritoryWithoutFort()
importData()
//callImportData on this to import empire data //if deriving from Info, remove this method.
isMajorEmpire()
isMinorEmpire()
isPartOfEmpire(territory)
territory -
loseAnArmy()
//Call when empire loses a battle.
makeCapitalBlink(bBlink)
bBlink -
numMonuments()
numResources()
pAddBoats()
//p:private to this class. Only call during empire placement. // Displays boat icons on all oceans and seas for empire.
setBase64String(sB64Data)
sB64Data -
setString(string)
string -
setStringV2(string)
string -
setThrob()
//default is to throb or dethrob whole empire using bShow. // bVacantMonuments: opt: default is false. When true, only throb if the // land has no monument. // bResourcesOnly: opt: default to fale. When true, only throb territories // with resources (and probably also without monuments)
setToBitData(aBits)
aBits -
spendArmy2AddFort(territory)
territory -
spendCoin2AddFort(territory)
territory -
spendCoin2ReviveArmy()
spendFort2AddFort(territory)
territory -
start()
//preconditions: Data has been imported for this empire.
subCoins(iCoins)
iCoins -
titleHas()
//Returns Have or Has depending on if Empire Title is plural
titleIsPlural()
updateRemainingArmiesOnscreen()
updateRemainingCoinsOnscreen()
updateRemainingFortsOnscreen()