File: Games\Empires\Game.js

GamesByEmail
Class EmpiresDealer

Object
  
 
 
GamesByEmail.EmpiresDealer

All Implemented Interfaces:

Class, Elemental


GamesByEmail.EmpiresDealer

implements Foundation.Class, Foundation.Elemental

Constructor Summary
GamesByEmail.EmpiresDealer()
//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
 assignDealtEmpireToTeam(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()
 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)
 getEmpireSummaryBgImageHtml()
//display background colour swatch
 getEmpiresForThisEpochHtml(/*stringBuilder*/)
 getPickEmpireCenterPanelHtml(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)
 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)

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

EmpiresDealer

GamesByEmail.EmpiresDealer()

//SCOTT - no longer extending GamesByEmail.Game, instead implementing //Foundation.Elemental and declaring the few needed functions

Field Detail

avg

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

assignDealtEmpireToTeam(iTeam)
Parameters:
iTeam - 


autoPickEmpires

static autoPickEmpires()

// static member! //preconditions: Game is set to appropriate Epoch. // inputs: game. bShuffle: when true, teams are re-ordered in turnOrder array


debug

debug()

//SCOTT - created debug function and replaced all instances //of this.game.debug with this.debug


dispose

dispose()
Overrides:
dispose in class Class

endOfPickEmpireTurnDialog

endOfPickEmpireTurnDialog()

endTurn

endTurn()

ensureResigningPlayerKeepsOrGivesAwayDealtEmpire

ensureResigningPlayerKeepsOrGivesAwayDealtEmpire()

//Preconditions: Player has resigned before making a decision on // what to do with their empire. :O


getAvgStr4Epoch

static getAvgStr4Epoch()

//Uses game.iEpoch to determine average strength of empires


getCardStyle

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

getEmpireCardHtml()

//dlgInfo: object from resources with data about the dialog.


getEmpireListCardHtml

getEmpireListCardHtml(dlgInfo)
Parameters:
dlgInfo - 


getEmpireSummaryBgImageHtml

getEmpireSummaryBgImageHtml()

//display background colour swatch


getEmpiresForThisEpochHtml

getEmpiresForThisEpochHtml(/*stringBuilder*/)
Parameters:
/*stringBuilder*/ - 
h

getPickEmpireCenterPanelHtml

getPickEmpireCenterPanelHtml(dlgInfo)
Parameters:
dlgInfo - 


getRadioButtonsHtml

getRadioButtonsHtml()

//Returns: html string containing list of input elements. // one radio button for each player without an empire


hideStuckWithDialogAndShowPickEmpire

hideStuckWithDialogAndShowPickEmpire()

hideViewEmpiresDlg

hideViewEmpiresDlg()

hideYouDrewThisEmpire

hideYouDrewThisEmpire()

prepForNextTurn

prepForNextTurn()

randomlyChooseAnUntakenEmpire

static randomlyChooseAnUntakenEmpire()

// Static Methods and Properties


randomlyPickTeamWithoutAnEmpire

randomlyPickTeamWithoutAnEmpire()

//Don't pick current player's team


searchTeamsForDealtEmpire

searchTeamsForDealtEmpire()

//returns team which has empire matching dealtEmpireId or NONE


shouldIKeepEmpire

static shouldIKeepEmpire(game)
Parameters:
game - 


showEmpireForLogDialog

showEmpireForLogDialog()

showEmpireListHeader

showEmpireListHeader()

//h: html stringBuilder


showEmpireSummary

showEmpireSummary()

//card. Game Resource object with info about the EmpireListCard. //iRow, vertical position in list of 7 empires


showPickAnEmpireDialog2

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

showPickEmpireDialog()

showStuckWithEmpireDialog

showStuckWithEmpireDialog()

teamToSluffTo

static teamToSluffTo()

//tp: Player who has an empire (team-playing)


undo

undo()

viewEmpires

viewEmpires()

viewLog

viewLog(num)
Parameters:
num -