File: Games\Empires\Game.js

GamesByEmail
Class Empire

Object
  
 
 
GamesByEmail.Empire

All Implemented Interfaces:

Class


GamesByEmail.Empire

implements Foundation.Class

Constructor Summary
GamesByEmail.Empire(game)

Method Summary
 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)
 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)
 addToTerritories(territoryId)
 assignCards()
//aCardsInPlay is an array with up to 2 cardIds.
 blinkTerritoriesWhichCanAttack(territory)
 blurt()
 bordersActiveEmpire()
//true if territory borders this empire.
 canAttack(territory)
 canAttackFromMultipleLocations(territory)
 canBuildFort()
 canStillExpand()
 demoteJihad()
 discard(iCardId)
 dispose()
 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)
 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)
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)
 hasNavalIn(territory)
 hasResourceTerritoriesWithoutMonuments()
 hasSpaceForMonument()
 hasTerritoryWithoutFort()
 importData()
//callImportData on this to import empire data //if deriving from Info, remove this method.
 isMajorEmpire()
 isMinorEmpire()
 isPartOfEmpire(territory)
 loseAnArmy()
//Call when empire loses a battle.
 makeCapitalBlink(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)
 setString(string)
 setStringV2(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)
 spendArmy2AddFort(territory)
 spendCoin2AddFort(territory)
 spendCoin2ReviveArmy()
 spendFort2AddFort(territory)
 start()
//preconditions: Data has been imported for this empire.
 subCoins(iCoins)
 titleHas()
//Returns Have or Has depending on if Empire Title is plural
 titleIsPlural()
 updateRemainingArmiesOnscreen()
 updateRemainingCoinsOnscreen()
 updateRemainingFortsOnscreen()

Methods inherited from Foundation.Class
getTypePath, isInstanceOf

Constructor Detail

Empire

GamesByEmail.Empire(game)
Parameters:
game - 

Method Detail

addAlliesBonus

addAlliesBonus()

addAnyAdjacentNavalTerritories

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

addAnyNewTerritoriesToThrobList()

addCivilServiceBonus

addCivilServiceBonus()

addCoins

addCoins(iCoins)
Parameters:
iCoins - 


addEngineeringBonus

addEngineeringBonus()

addFortTo

addFortTo()

//treat this as private


addMonument

addMonument()

//don't pass in a territory that isn't in this empire! //decrements iMonuments.


addToEmpire

addToEmpire()

//Adds input territory to this empire.


addToNaval

addToNaval(territoryIndex)
Parameters:
territoryIndex - 


addToTerritories

addToTerritories(territoryId)
Parameters:
territoryId - 


assignCards

assignCards()

//aCardsInPlay is an array with up to 2 cardIds.


blinkTerritoriesWhichCanAttack

blinkTerritoriesWhichCanAttack(territory)
Parameters:
territory - 


blurt

blurt()

bordersActiveEmpire

bordersActiveEmpire()

//true if territory borders this empire.


canAttack

canAttack(territory)
Parameters:
territory - 


canAttackFromMultipleLocations

canAttackFromMultipleLocations(territory)
Parameters:
territory - 


canBuildFort

canBuildFort()

canStillExpand

canStillExpand()

demoteJihad

demoteJihad()

discard

discard(iCardId)
Parameters:
iCardId - 


dispose

dispose()
Overrides:
dispose in class Class

doesCapitalHaveAMonument

doesCapitalHaveAMonument()

empireToString

static empireToString()

// Static methods and properties.


getALink

static getALink()

//returns a link object ( has .name + .url ), OR null if none found.


getAlliesBonus

getAlliesBonus()

//calculates & returns the bonus, but doesn't alter class state //(called from log)


getAttackFromTerritory

getAttackFromTerritory(territory)
Parameters:
territory - 


getCapitalID

getCapitalID()

getCivilServiceBonus

getCivilServiceBonus()

getEngineeringBonus

getEngineeringBonus()

getEpoch

getEpoch()

getLink

static getLink()

//style: optional param to set the style of the anchor //postconditions: You add "" to close off the anchor.


getNavalString

static getNavalString(empireId,
                      game)
Parameters:
empireId - 

game - 


getNavalTerritoriesString

static getNavalTerritoriesString()

//Called from empiresDealer to EmpiresList Card


getNextCapitalWithoutMonument

getNextCapitalWithoutMonument()

//returns territory id or NONE


getString

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

hasACapital()

hasCard

hasCard(iCard)
Parameters:
iCard - 


hasNavalIn

hasNavalIn(territory)
Parameters:
territory - 


hasResourceTerritoriesWithoutMonuments

hasResourceTerritoriesWithoutMonuments()

hasSpaceForMonument

hasSpaceForMonument()

hasTerritoryWithoutFort

hasTerritoryWithoutFort()

importData

importData()

//callImportData on this to import empire data //if deriving from Info, remove this method.


isMajorEmpire

isMajorEmpire()

isMinorEmpire

isMinorEmpire()

isPartOfEmpire

isPartOfEmpire(territory)
Parameters:
territory - 


loseAnArmy

loseAnArmy()

//Call when empire loses a battle.


makeCapitalBlink

makeCapitalBlink(bBlink)
Parameters:
bBlink - 


numMonuments

numMonuments()

numResources

numResources()

pAddBoats

pAddBoats()

//p:private to this class. Only call during empire placement. // Displays boat icons on all oceans and seas for empire.


setBase64String

setBase64String(sB64Data)
Parameters:
sB64Data - 


setString

setString(string)
Parameters:
string - 


setStringV2

setStringV2(string)
Parameters:
string - 


setThrob

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

setToBitData(aBits)
Parameters:
aBits - 


spendArmy2AddFort

spendArmy2AddFort(territory)
Parameters:
territory - 


spendCoin2AddFort

spendCoin2AddFort(territory)
Parameters:
territory - 


spendCoin2ReviveArmy

spendCoin2ReviveArmy()

spendFort2AddFort

spendFort2AddFort(territory)
Parameters:
territory - 


start

start()

//preconditions: Data has been imported for this empire.


subCoins

subCoins(iCoins)
Parameters:
iCoins - 


titleHas

titleHas()

//Returns Have or Has depending on if Empire Title is plural


titleIsPlural

titleIsPlural()

updateRemainingArmiesOnscreen

updateRemainingArmiesOnscreen()

updateRemainingCoinsOnscreen

updateRemainingCoinsOnscreen()

updateRemainingFortsOnscreen

updateRemainingFortsOnscreen()