Games\WW2\Game.js
GamesByEmail
Object
GamesByEmail.Game
All Implemented Interfaces:
GamesByEmail.WW2Game
extendsGame
Constructor Summary |
|
Field Summary | |
static | resourcePack
Resources for most of the game. Override to add resources specific to game.
|
Fields inherited from GamesByEmail.Game |
board , canPie , constrainer , font , id , info , isLog , lastMove , logSettings , maxMoveNumber , message , move , notify , onLeftMouseDown , onLeftMouseUp , onMiddleMouseDown , onMiddleMouseUp , onMouseDown , onMouseMove , onMouseOut , onMouseOver , onMouseUp , onRightMouseDown , onRightMouseUp , pieces , previewing , rotation , status , teams , territories , testing , title , type , verbose |
Fields inherited from Foundation.Elemental |
$Foundation_$registry_index |
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 |
Methods inherited from Foundation.Resourceful |
resource , resource , resourceUrl , resourceUrl |
Methods inherited from Foundation.Server |
server , serverSerialized , serverSynchronous |
Constructor Detail |
GamesByEmail.WW2Game()
Field Detail |
static Object
resourcePack
Resources for most of the game. Override to add resources specific to game.
Overrides:resourcePack
in class Game
Method Detail |
StringBuilder
appendBoardHtml(/*StringBuilder
*/ htmlBuilder)
Appends the HTML for the game board (usually an image) and the pieces or territories on it.
Overrides:appendBoardHtml
in class Game
htmlBuilder -The builder to append the HTML for the board.
areFriendly(powerIndex1,
powerIndex2)
powerIndex1 -
powerIndex2 -
arrowHtml(up)
up -
attackTerritory(point)
point -
backButton(inline)
inline -
backButtonTag()
blink()
bombHtml(power)
power -
bounceMessages(startBounce)
startBounce -
callOffAssault(territory)
territory -
callOffAssaultAtIndex(tIndex)
tIndex -
cancelGameButton()
chooseCombatTerritoryHtml()
chooseTerritoryToAttackHtml()
cleanUpStrategicBombingRaid(territory)
territory -
cleanUpStrategicBombingRaidAtIndex(tIndex)
tIndex -
clearForNextTurn()
clearMoves()
closeSecondaryAttackAtIndex(tIndex)
tIndex -
collectIncomeHtml()
combatTerritory(point)
point -
combatUnitsOrderedAtIndex(tIndex)
tIndex -
dieHtml(attacker,
roll)
attacker -
roll -
displayOptions()
dispose()
doNothing()
falseBackButton(id,
arg)
id -
arg -
fillRocketAttackList(list,
attackerIndex,
targetIndex,
range)
list -
attackerIndex -
targetIndex -
range -
String
gameOverHtml()
Called when needing the game-over game prompts HTML. Override to set. Internally returns one of the following: theyResignedHtml
, youResignedHtml
, youTiedHtml
, drawAcceptedHtml
, youWinHtml
or youLoseHtml
.
gameOverHtml
in class Game
getDevelopmentString(team)
team -
getDevelopments()
getNewGame2PlayerOrder(userInfo)
userInfo -
getNewGame3PlayerOrder(userInfo)
userInfo -
getNewGame4PlayerOrder(userInfo)
userInfo -
getNewGame5PlayerOrder(userInfo)
userInfo -
Array
getNewGamePlayerOrder(/*Array
*/ userInfo)
Orders the players for the next game. By default the user information is reversed.
Overrides:getNewGamePlayerOrder
in class Game
userInfo -An array of user information as currently in this game.
getPieceImage(team,
index)
team -
index -
getRightLinksHtml()
getRocketAttackInfo(team)
team -
getRollsString(rolls)
rolls -
getStateString()
getString()
getTeamString(team)
team -
getTeamsString()
handleGameOver()
hasLandPlanesOptions()
hitPieceAtIndex(tIndex,
pIndex)
tIndex -
pIndex -
void
initialize(/*Number
*/ numPlayers,
/*Number
*/ turnTeamIndex)
The first method to be called when a game is created, override to set up teams, players and the game state.
Overrides:initialize
in class Game
numPlayers -The number of players from the game form.
turnTeamIndex -The index of the team to set the initial turn. Call the Super with -1 to set all teams turn.
Example:
// Override initialize initialize:function(numPlayers,turnTeamIndex) { // Call the Super.initialize to add default teams. Super.initialize(numPlayers,turnTeamIndex); // Initialize the board state. this.info["board"]="rnbqkbnrpppppppp PPPPPPPPRNBQKBNR"; var team=this.teams[0]; team.info["i_ep"]=-1; team.info["b_cs"]=true; team.info["b_cl"]=true; team=this.teams[1]; team.info["i_ep"]=-1; team.info["b_cs"]=true; team.info["b_cl"]=true; // Log the start of game. this.move.log=this.logEntry(44); }
void
initializeNewGameForm(/*GameForm
*/ gameForm,
/*Array
*/ userInfo)
Seeds the game form options with values from the current game.
Overrides:initializeNewGameForm
in class Game
gameForm -The game form to seed.
userInfo -An array of user information.
initializePowers()
isAllies(powerIndex)
powerIndex -
isAxis(powerIndex)
powerIndex -
landPlaneAtIndex(tIndex,
oIndex,
lIndex,
cIndex)
tIndex -
oIndex -
lIndex -
cIndex -
landPlanes(point)
point -
landPlanesPrompt(anyLeftToLand)
anyLeftToLand -
loadAndMoveTransportAtIndex(tIndex,
mIndex)
tIndex -
mIndex -
logAAGunPhrase(numGuns)
numGuns -
logAircraftPhrase(aircraftUnit,
numAircraft)
aircraftUnit -
numAircraft -
logBattleshipPhrase(numBattleships)
numBattleships -
logBombPhrase(numBombs)
numBombs -
logBomberPhrase(numBombers)
numBombers -
logFighterPhrase(numFighters)
numFighters -
logHitPhrase(numHits)
numHits -
logIpcPhrase(numIpcs)
numIpcs -
logMovementButtons(needBackground)
needBackground -
logRoll(roll)
roll -
logRollString(rolls)
rolls -
logSpacePhrase(numSpaces)
numSpaces -
logSubmarinePhrase(numSubmarines)
numSubmarines -
logUnitPhrase(numUnits)
numUnits -
logWasPhrase(num)
num -
maybeEndTempHide(event)
event -
maybeStartTempHide(event)
event -
maybeSwitchPower()
moveAllNumAvailAtIndex(tIndex,
mIndex,
pIndex)
tIndex -
mIndex -
pIndex -
moveAllNumMovedAtIndex(tIndex,
mIndex,
pIndex)
tIndex -
mIndex -
pIndex -
moveOneNumAvailAtIndex(tIndex,
mIndex,
pIndex)
tIndex -
mIndex -
pIndex -
moveOneNumMovedAtIndex(tIndex,
mIndex,
pIndex)
tIndex -
mIndex -
pIndex -
moveToNextTeamsTurn()
moveTransportAtIndex(tIndex)
tIndex -
newUnits()
nextPhase(phase)
phase -
nextPhaseButton(id,
index,
hidden)
id -
index -
hidden -
noCombatThisTurn()
nonCombatMove(point)
point -
nonCombatMovesPrompt()
notMyTurnHtml()
notOurTurnButtons()
numUnits(unit,
delta)
unit -
delta -
numUnitsPurchased(unit)
unit -
openFaq(event)
event -
openFaqHtml()
openMapEditor(mouseEvent)
mouseEvent -
openTeamMessage(event)
event -
openTeamMessageHtml()
openUnitSheet(event)
event -
openUnitSheetHtml()
orderByCostButton()
orderCombatUnitsByCostAtIndex(tIndex)
tIndex -
orderRemainingByCost()
placeNewUnitAtIndex(uIndex,
pIndex)
uIndex -
pIndex -
placeNewUnitsHtml()
placePurchasedUnits()
placePurchasedUnitsProcess()
powerLogColor(powerIndex)
powerIndex -
powerTitleHtml(team,
emptyTitles)
team -
emptyTitles -
previewBattleBoardAtIndex(tIndex)
tIndex -
processGoBack()
processNonCombatMoves()
purchaseRowHtml(oddRow,
power,
unit)
oddRow -
power -
unit -
purchaseUnit(unit)
unit -
purchaseUnits()
purchaseUnitsHtml()
removeHitPieces(territory,
preBattle)
territory -
preBattle -
removeHitPiecesAtIndex(tIndex)
tIndex -
removePlaneHitsAtIndex(tIndex)
tIndex -
researchDevelopmentHtml()
researchResultsHtml()
void
resign()
Resignes the current player. Clears mouse events, sets the player as resigned, and sends the move.
Overrides:
resignPower(team)
team -
resolveCombat(territory,
amphibiousSet,
mapClick)
territory -
amphibiousSet -
mapClick -
resolveCombatAmphibiousSetAtIndex(tIndex)
tIndex -
resolveCombatAtIndex(tIndex)
tIndex -
retreatAtIndex(tIndex)
tIndex -
retreatToAtIndex(tIndex,
rIndex)
tIndex -
rIndex -
rocketAttack(territoryIndex)
territoryIndex -
rocketAttackHtml()
rocketAttackOdds()
rocketAttackResultsHtml()
rocketWithinRange(territories,
attackerIndex,
range)
territories -
attackerIndex -
range -
rollForCombat(territory)
territory -
rollForCombatAtIndex(tIndex)
tIndex -
rollForCombatAtIndex(tIndex)
tIndex -
rollsByString(string)
string -
Boolean
sendMove(/*Boolean
*/ sendNow,
/*Player
*/ player)
Gets called when the Send Move button is pushed. Override and set the game state, then call Super.sendMove.
Overrides: Parameters:sendNow -(Optional) Send the moves to the server now. Else, save the move for sending later. Defaults to
true
.player -(Optional) The player responsible for the move. Defaults to the current player (game.player).
true
.
setCompassRoseBlink(blink)
blink -
setDefenseOrder(point)
point -
setDefenseOrderPrompt(anyLeftToOrder)
anyLeftToOrder -
setDevelopmentByString(team,
string)
team -
string -
setDisabled()
setGamePrompts(html,
track,
compassHtml)
html -
track -
compassHtml -
setNextPhaseButtonHidden(hidden)
hidden -
setStateByString(string)
string -
setString(string,
purchased)
string -
purchased -
setTeamByString(team,
string)
team -
string -
setTeamsByString(string)
string -
setTrackPrompts(html,
trackEvent)
html -
trackEvent -
setWeaponsDevelopmentHtml(change)
change -
showBattleOdds(event)
event -
void
showTransactionPrompt(/*String
*/ resourceName)
Shows the a tranaction message (Sending Move, Initializing, etc.).
Overrides:showTransactionPrompt
in class Game
resourceName -The resource to display.
simpleTrackHtml()
spendDevelopment(numChances)
numChances -
startAnotherGameButton()
startTurn()
startTurnHtml()
staticBackButton(checkPhase)
checkPhase -
stopTrackPrompts()
void
synch()
Called when the game should synchronize with info
properties from the server.
synchCombatLogHtml()
teamCanAffordResearch(team)
team -
teamCanCollectIncome(team)
team -
teamCanManufacture(team)
team -
teamCanResearch(team)
team -
teamCanRocketAttack(team)
team -
Number
teamColorFromTeam(/*Team
*/ team)
Gets the team color.
Overrides:teamColorFromTeam
in class Game
team -The team to get the color of.
teamHasDevelopmentsLeft(team)
team -
teamHasMoves(team)
team -
teamHasPlayableCombatUnits(team)
team -
teamTitlesHtml(emptyTitles)
emptyTitles -
toggleHitPiece(territory,
pieceIndex)
territory -
pieceIndex -
totalPurchaseCost()
trackOnMouseDown(point)
point -
trackOnMouseMove(point,
arg,
event)
point -
arg -
event -
trackOnMouseOut(point)
point -
unassignedUnitsOnTransports(attack)
attack -
undoAllLandings()
undoNonCombat()
unitFromMusterIndex(muster)
muster -
unitFromUnitIndex(unitIndex)
unitIndex -
unitPurchaseCost(unit)
unit -
unlandPlaneAtIndex(tIndex,
oIndex,
lIndex,
cIndex)
tIndex -
oIndex -
lIndex -
cIndex -
unloadAllNumAvailAtIndex(tIndex,
aIndex)
tIndex -
aIndex -
unloadAllNumMovedAtIndex(tIndex,
aIndex)
tIndex -
aIndex -
unloadOneNumAvailAtIndex(tIndex,
aIndex)
tIndex -
aIndex -
unloadOneNumMovedAtIndex(tIndex,
aIndex)
tIndex -
aIndex -
unplaceNewUnitAtIndex(uIndex,
pIndex)
uIndex -
pIndex -
unpurchaseUnit(unitPurchaseChar)
unitPurchaseChar -
unpurchaseUnits()
void
update()
Updates the team titles, the game header, the game title, all prompts and action links.
Overrides:
updateAttackMovesAtIndex(tIndex)
tIndex -
updateCompassHilite(blinkOn)
blinkOn -
updateFurther(phaseIsNew)
phaseIsNew -
updateLogFurther()
updateNonCombatMovesAtIndex(tIndex)
tIndex -
updatePurchaseBoard()
updatePurchaseRow(unit,
total)
unit -
total -
void
updateTeamTitles()
Updates the top and bottom team title rows.
Overrides:updateTeamTitles
in class Game
verifyPurchase()
weaponsDevelopmentHtml()