Games\Empires\Game.js
GamesByEmail
Object
All Implemented Interfaces:
GamesByEmail.EmpiresDealer
implementsFoundation.Class
,Foundation.Elemental
Constructor Summary |
//SCOTT - no longer extending GamesByEmail.Game, instead implementing
//Foundation.Elemental and declaring the few needed functions
|
Field Summary | |
static | avg
// autoPickEmpires Logic:
// ======================
//make a copy of the teams.
//sort the copy into empire picking order.
//for each player,
//randomly choose one empire.
//If empire strength > average strength this epoch, keep it.
//if empire goes in first 2 turns AND player has more than x
//territories already on the board,
//keep it to try to score those territories again.
//Otherwise,
//give the empire to the player with the highest score who
//doesn't have an empire yet.
//Set teamWhoDealtUsThisEmpire, just for kicks.
//postconditions: game.teams have dealtEmpireId set.
|
Fields inherited from Foundation.Elemental |
$Foundation_$registry_index |
Method Summary | |
|
|
static |
// static member!
//preconditions: Game is set to appropriate Epoch.
// inputs: game. bShuffle: when true, teams are re-ordered in turnOrder array
|
|
//SCOTT - created debug function and replaced all instances
//of this.game.debug with this.debug
|
|
|
|
|
|
|
|
//Preconditions: Player has resigned before making a decision on
// what to do with their empire. :O
|
static |
//Uses game.iEpoch to determine average strength of empires
|
|
// cardInfo defines a point for height + width & src, a string with bg image
// file name relative to the Boards\Default directory
// card:
src:"Images/PickEmpCard.png" ,
// size:new Foundation.Point(254 , 347) //height + width
// ,
// pos.x pos.y left+top are position within containing element (px)
// returns the style string for a DOM element (div) |
|
//dlgInfo: object from resources with data about the dialog.
|
|
|
|
//display background colour swatch
|
|
|
|
|
|
//Returns: html string containing list of input elements.
// one radio button for each player without an empire
|
|
|
|
|
|
|
|
|
static |
// Static Methods and Properties
|
|
//Don't pick current player's team
|
|
//returns team which has empire matching dealtEmpireId or NONE
|
static |
|
|
|
|
//h: html stringBuilder
|
|
//card. Game Resource object with info about the EmpireListCard.
//iRow, vertical position in list of 7 empires
|
|
//Preconditions: this.dealtEmpireId is set to an empire that's been dealt
// to this player.
// this.game.player.team.majorEmpireIndex is set to NONE, or set to an
// empire already dealt to this player.
|
|
|
|
|
static |
//tp: Player who has an empire (team-playing)
|
|
|
|
|
|
|
Methods inherited from Foundation.Class |
getTypePath , isInstanceOf |
Methods inherited from Foundation.Elemental |
attachEvent , detachEvent , elementId , event , getById , getElement , getElementValue , getElements , getFirst , getNext , parseElementId , processHtml , processHtml |
Constructor Detail |
GamesByEmail.EmpiresDealer()
//SCOTT - no longer extending GamesByEmail.Game, instead implementing //Foundation.Elemental and declaring the few needed functions
Field Detail |
static avg
// autoPickEmpires Logic: // ====================== //make a copy of the teams. //sort the copy into empire picking order. //for each player, //randomly choose one empire. //If empire strength > average strength this epoch, keep it. //if empire goes in first 2 turns AND player has more than x //territories already on the board, //keep it to try to score those territories again. //Otherwise, //give the empire to the player with the highest score who //doesn't have an empire yet. //Set teamWhoDealtUsThisEmpire, just for kicks. //postconditions: game.teams have dealtEmpireId set.
Method Detail |
assignDealtEmpireToTeam(iTeam)
iTeam -
static autoPickEmpires()
// static member! //preconditions: Game is set to appropriate Epoch. // inputs: game. bShuffle: when true, teams are re-ordered in turnOrder array
debug()
//SCOTT - created debug function and replaced all instances //of this.game.debug with this.debug
dispose()
dispose
in class Class
endOfPickEmpireTurnDialog()
endTurn()
ensureResigningPlayerKeepsOrGivesAwayDealtEmpire()
//Preconditions: Player has resigned before making a decision on // what to do with their empire. :O
static getAvgStr4Epoch()
//Uses game.iEpoch to determine average strength of empires
getCardStyle()
// cardInfo defines a point for height + width & src, a string with bg image
// file name relative to the Boards\Default directory
// card: src:"Images/PickEmpCard.png"
,
// size:new Foundation.Point(254
, 347) //height + width
//
,
// pos.x pos.y left+top are position within containing element (px)
// returns the style string for a DOM element (div)
getEmpireCardHtml()
//dlgInfo: object from resources with data about the dialog.
getEmpireListCardHtml(dlgInfo)
dlgInfo -
getEmpireSummaryBgImageHtml()
//display background colour swatch
getEmpiresForThisEpochHtml(/*stringBuilder*/)
/*stringBuilder*/ -h
getPickEmpireCenterPanelHtml(dlgInfo)
dlgInfo -
getRadioButtonsHtml()
//Returns: html string containing list of input elements. // one radio button for each player without an empire
hideStuckWithDialogAndShowPickEmpire()
hideViewEmpiresDlg()
hideYouDrewThisEmpire()
prepForNextTurn()
static randomlyChooseAnUntakenEmpire()
// Static Methods and Properties
randomlyPickTeamWithoutAnEmpire()
//Don't pick current player's team
searchTeamsForDealtEmpire()
//returns team which has empire matching dealtEmpireId or NONE
static shouldIKeepEmpire(game)
game -
showEmpireForLogDialog()
showEmpireListHeader()
//h: html stringBuilder
showEmpireSummary()
//card. Game Resource object with info about the EmpireListCard. //iRow, vertical position in list of 7 empires
showPickAnEmpireDialog2()
//Preconditions: this.dealtEmpireId is set to an empire that's been dealt // to this player. // this.game.player.team.majorEmpireIndex is set to NONE, or set to an // empire already dealt to this player.
showPickEmpireDialog()
showStuckWithEmpireDialog()
static teamToSluffTo()
//tp: Player who has an empire (team-playing)
undo()
viewEmpires()
viewLog(num)
num -