File: Games\Empires\Game.js

GamesByEmail
Class EmpiresBattleDialog

Object
  
 
 
GamesByEmail.EmpiresBattleDialog

All Implemented Interfaces:

Class, Elemental


GamesByEmail.EmpiresBattleDialog

implements Foundation.Class, Foundation.Elemental

Constructor Summary
GamesByEmail.EmpiresBattleDialog()
//inherit from this

Field Summary

Fields inherited from Foundation.Elemental
$Foundation_$registry_index

Method Summary
 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()
 doCombat(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)
 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)
 getString()
 getTerritoryInfo(fromTerritoryId, toTerritoryId)
 hide()
//called when user cancels combat, or closes, or occupies etc.
 isAttackBySea()
 isBattleModInPlay(iMod)
 isCivilWar()
 isJihad1To2Transition()
 loadCombat()
//After calling setString, call loadCombat to display the combat dialog.
 occupyDefenderTerritory(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)
 show()
//////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// //// Treat the rest of this as private implementation////// //////////////////////////////////////////////////////////// // iMode this.MODE.PREVIEW:0 this.MODE.RESULTS:1
 showBattleModifiers(htmlBuilder)
 showCaption(htmlBuilder, dlgInfo)
 showCombatResults(htmlBuilder, dlgInfo)

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

EmpiresBattleDialog

GamesByEmail.EmpiresBattleDialog()

//inherit from this

Method Detail

attackerJustLostAnArmy

attackerJustLostAnArmy()

blurt

blurt()

// methods and properties


checkIfUserSpentACoin

checkIfUserSpentACoin()

//if the checkbox can be found, and it's set, spend a coin //to revive an army.


convertToInteger

convertToInteger()

//preconditions: input array contains strings


didLeaderJustDie

didLeaderJustDie()

didSpecialTroopsJustLostAnArmy

didSpecialTroopsJustLostAnArmy()

//preconditions: Combat Results are being shown. // iBattleMod can be: ELITE_TROOPS,JIHAD_1 or JIHAD_2


dispose

dispose()
Overrides:
dispose in class Class

doCombat

doCombat(fromTerritoryId,
         toTerritoryId)
Parameters:
fromTerritoryId - 

toTerritoryId - 


doExpertTroopsNullifyTerrain

doExpertTroopsNullifyTerrain()

//If iBattleModifier is a defensive bonus for difficult terrain, //check if the attacker has an expert troop card to nullify it


doesBattleModifierApply

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

getAllBattleModifiers()

//sigh.. such ugly code. Yet to think of a better way


getDialogButtons

getDialogButtons()

//assigns battle dialog buttons to htmlBuilder. //eg: 'Cancel' 'Attack' or 'Attack again'


getDialogLocation

getDialogLocation(dlgInfo)
Parameters:
dlgInfo - 


getDialogRegion

getDialogRegion()

getDialogStyles

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

getLastBattleDescription(bWithLineBreaks)
Parameters:
bWithLineBreaks - 


getString

getString()

getTerritoryInfo

getTerritoryInfo(fromTerritoryId,
                 toTerritoryId)
Parameters:
fromTerritoryId - 

toTerritoryId - 


hide

hide()

//called when user cancels combat, or closes, or occupies etc.


isAttackBySea

isAttackBySea()

isBattleModInPlay

isBattleModInPlay(iMod)
Parameters:
iMod - 


isCivilWar

isCivilWar()

isJihad1To2Transition

isJihad1To2Transition()

loadCombat

loadCombat()

//After calling setString, call loadCombat to display the combat dialog.


occupyDefenderTerritory

occupyDefenderTerritory(bHideDialog,
                        bRazeCity)
Parameters:
bHideDialog - 

bRazeCity - 


reset

reset()

//reset all class state for the next battle.


resetBattleModifiers

resetBattleModifiers()

resolveCombat

resolveCombat()

//Called when user clicks ok. //rolls dice to see who wins.


resolveCombatSpecialScenarios

resolveCombatSpecialScenarios()

//Preconditions: Called during showMode RESULTS //Returns: string w/custom message for battleDialog


resumeCivilWar

resumeCivilWar()

setString

setString(string)
Parameters:
string - 


show

show()

//////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// //// Treat the rest of this as private implementation////// //////////////////////////////////////////////////////////// // iMode this.MODE.PREVIEW:0 this.MODE.RESULTS:1


showBattleModifiers

showBattleModifiers(htmlBuilder)
Parameters:
htmlBuilder - 


showCaption

showCaption(htmlBuilder,
            dlgInfo)
Parameters:
htmlBuilder - 

dlgInfo - 


showCombatResults

showCombatResults(htmlBuilder,
                  dlgInfo)
Parameters:
htmlBuilder - 

dlgInfo -