Games\Empires\Game.js
GamesByEmail
Object
All Implemented Interfaces:
GamesByEmail.EmpiresBattleDialog
implementsFoundation.Class
,Foundation.Elemental
Constructor Summary |
//inherit from this
|
Field Summary |
Fields inherited from Foundation.Elemental |
$Foundation_$registry_index |
Method Summary | |
|
|
|
// methods and properties
|
|
//if the checkbox can be found, and it's set, spend a coin
//to revive an army.
|
|
//preconditions: input array contains strings
|
|
|
|
//preconditions: Combat Results are being shown.
// iBattleMod can be: ELITE_TROOPS,JIHAD_1 or JIHAD_2
|
|
|
|
|
|
//If iBattleModifier is a defensive bonus for difficult terrain,
//check if the attacker has an expert troop card to nullify it
|
|
//return true if a given card applies to combat.
//Judgement call:If a user has a card in play that can affect combat, I think it's
//better to show that battle modifier and then apply a strike through style to it,
//than to not show the battle modifier at all.
|
|
//sigh.. such ugly code. Yet to think of a better way
|
|
//assigns battle dialog buttons to htmlBuilder.
//eg: 'Cancel' 'Attack' or 'Attack again'
|
|
|
|
|
|
//Gets Combat Dialog Styles from resource definition & initializes it
//This allows same font color to be applied to several styles... etc.
//Note: This was a badly hacked function and needs to be re-written...
//well, whole styles of Empires needs to be redone to use CSS.
|
|
|
|
|
|
|
|
//called when user cancels combat, or closes, or occupies etc.
|
|
|
|
|
|
|
|
|
|
//After calling setString, call loadCombat to display the combat dialog.
|
|
|
|
//reset all class state for the next battle.
|
|
|
|
//Called when user clicks ok.
//rolls dice to see who wins.
|
|
//Preconditions: Called during showMode RESULTS
//Returns: string w/custom message for battleDialog
|
|
|
|
|
|
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
//// Treat the rest of this as private implementation//////
////////////////////////////////////////////////////////////
// iMode this.MODE.PREVIEW:0 this.MODE.RESULTS:1
|
|
|
|
|
|
|
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.EmpiresBattleDialog()
//inherit from this
Method Detail |
attackerJustLostAnArmy()
blurt()
// methods and properties
checkIfUserSpentACoin()
//if the checkbox can be found, and it's set, spend a coin //to revive an army.
convertToInteger()
//preconditions: input array contains strings
didLeaderJustDie()
didSpecialTroopsJustLostAnArmy()
//preconditions: Combat Results are being shown. // iBattleMod can be: ELITE_TROOPS,JIHAD_1 or JIHAD_2
dispose()
dispose
in class Class
doCombat(fromTerritoryId,
toTerritoryId)
fromTerritoryId -
toTerritoryId -
doExpertTroopsNullifyTerrain()
//If iBattleModifier is a defensive bonus for difficult terrain, //check if the attacker has an expert troop card to nullify it
doesBattleModifierApply()
//return true if a given card applies to combat. //Judgement call:If a user has a card in play that can affect combat, I think it's //better to show that battle modifier and then apply a strike through style to it, //than to not show the battle modifier at all.
getAllBattleModifiers()
//sigh.. such ugly code. Yet to think of a better way
getDialogButtons()
//assigns battle dialog buttons to htmlBuilder. //eg: 'Cancel' 'Attack' or 'Attack again'
getDialogLocation(dlgInfo)
dlgInfo -
getDialogRegion()
getDialogStyles()
//Gets Combat Dialog Styles from resource definition & initializes it //This allows same font color to be applied to several styles... etc. //Note: This was a badly hacked function and needs to be re-written... //well, whole styles of Empires needs to be redone to use CSS.
getLastBattleDescription(bWithLineBreaks)
bWithLineBreaks -
getString()
getTerritoryInfo(fromTerritoryId,
toTerritoryId)
fromTerritoryId -
toTerritoryId -
hide()
//called when user cancels combat, or closes, or occupies etc.
isAttackBySea()
isBattleModInPlay(iMod)
iMod -
isCivilWar()
isJihad1To2Transition()
loadCombat()
//After calling setString, call loadCombat to display the combat dialog.
occupyDefenderTerritory(bHideDialog,
bRazeCity)
bHideDialog -
bRazeCity -
reset()
//reset all class state for the next battle.
resetBattleModifiers()
resolveCombat()
//Called when user clicks ok. //rolls dice to see who wins.
resolveCombatSpecialScenarios()
//Preconditions: Called during showMode RESULTS //Returns: string w/custom message for battleDialog
resumeCivilWar()
setString(string)
string -
show()
//////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// //// Treat the rest of this as private implementation////// //////////////////////////////////////////////////////////// // iMode this.MODE.PREVIEW:0 this.MODE.RESULTS:1
showBattleModifiers(htmlBuilder)
htmlBuilder -
showCaption(htmlBuilder,
dlgInfo)
htmlBuilder -
dlgInfo -
showCombatResults(htmlBuilder,
dlgInfo)
htmlBuilder -
dlgInfo -