Games\Viktory2\Game.js
GamesByEmail
Object
GamesByEmail.Piece
All Implemented Interfaces:
GamesByEmail.Viktory2Piece
extendsPiece
Constructor Summary |
Creates a piece.
|
Field Summary |
Fields inherited from GamesByEmail.Piece |
boardPoint , hidden , index , pieces , valueIndex |
Method Summary | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Adds the pieces HTML to the a string builder.
#returns The string builder after appending.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Centers the piece on a point.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gets the clipping rectangle for this piece based on its color value.
#returns The clipping rectangle.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gets the screen rectangle for this piece based on its
boardPoint property. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Sets the 'temporary' visibility of a piece.
|
|
Centers the piece on a board point. The
boardPoint property is not altered. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Methods inherited from GamesByEmail.Piece |
create , elementId , event , getBoardValue , getElement , getImageSrc , isColor , isOurs , move , occupiesBoardPoint , remove , reset , setBoardValue , setColor , setHidden , setValue , setValueAndColor |
Methods inherited from Foundation.Class |
getTypePath , isInstanceOf |
Constructor Detail |
GamesByEmail.Viktory2Piece(/*Pieces
*/ pieces,
/*Number
*/ index,
/*Number
*/ value,
/*Number
*/ valueIndex,
/*Boolean
*/ hidden)
Creates a piece.
Parameters:pieces -The parent pieces object.
index -The position of this piece in the parent pieces object.
value -The value of this piece.
valueIndex -The position of this piece's value in the result of the pieces getValue call. Set to -1 to not include in getValue.
hidden -Whether the piece is visible to the current player or not.
Method Detail |
addPennantIfNeeded(color,
rulerColor,
update,
override)
color -
rulerColor -
update -
override -
addUnit(color,
type)
color -
type -
addUnitCounts(counts,
color)
counts -
color -
allAdjacentsVisible()
allowsRelocation(color,
rulerColor)
color -
rulerColor -
anyBombardersLeft(color)
color -
anyMoversLeft(color)
color -
StringBuilder
appendHtml(/*StringBuilder
*/ htmlBuilder)
Adds the pieces HTML to the a string builder. #returns The string builder after appending.
Overrides:appendHtml
in class Piece
htmlBuilder -The string builder to append to.
areRemainingMilitaryUnitsHomogeneous(unitList)
unitList -
attackerUnitClicked(unit)
unit -
battleCompleteLogEntry(color)
color -
battleOkClick(color,
start)
color -
start -
battleUnitClicked(unitIndex,
attacker)
unitIndex -
attacker -
bombardOkClick(color)
color -
canBeAttackedBy(color,
rulerColor,
bypassPennants)
color -
rulerColor -
bypassPennants -
void
center(/*Point
*/ screenPoint,
/*Boolean
*/ noConstrain)
Centers the piece on a point.
Overrides: Parameters:screenPoint -The screen point on which to center.
noConstrain -(Optional) Override the game's
GamesByEmail.Game.constrainer
rectangle.
centerUnload(unitType,
color,
screenPoint)
unitType -
color -
screenPoint -
clearUnitRelocating()
collectRetreatIndices(color)
color -
conquer(color,
update)
color -
update -
countHitUnitsForLogEntry(unitType,
color,
enemy)
unitType -
color -
enemy -
countHits(rolls,
hitThreshold)
rolls -
hitThreshold -
countMilitaryUnits(unitList)
unitList -
countNumHit(color)
color -
countNumOptionalHit(color)
color -
countOpponentMilitary(color)
color -
countRollingUnits(color)
color -
countTacticalHits(rolls)
rolls -
darkOrAdjacentDark()
debug()
defenderUnitClicked(unit)
unit -
dispose()
findAdjacentEnemyUnit(color,
rulerColor)
color -
rulerColor -
findArtillery(color)
color -
findCapital(color)
color -
findCavalry(color)
color -
findCivilization(color)
color -
findDoomsdayClock(color)
color -
findFrigate(color)
color -
findInfantry(color)
color -
findLeastNeededCargo(color,
cargoType,
cargoExpendability)
color -
cargoType -
cargoExpendability -
findLeastNeededUnit(color,
unitType,
cargoExpendability)
color -
unitType -
cargoExpendability -
findMilitary(color)
color -
findOpponent(color)
color -
findOpponentCapital(color)
color -
findOpponentCivilization(color)
color -
findOpponentMilitary(color)
color -
findOpponentPennant(color)
color -
findOpponentUnit(color,
unitType)
color -
unitType -
findPennant(color)
color -
findSubjugationFlag(color)
color -
findTown(color)
color -
findUnit(color,
unitType)
color -
unitType -
forfeitPendingBattle(color)
color -
getAdjacentIndecies(radius)
radius -
getArtilleryUnitList(color)
color -
getAttackerHitPromts()
getBattleBoxDividerHtml()
getBattleContainerStyle()
getBattleHtml(color,
round,
attackerRolls,
defenderRolls,
retreats)
color -
round -
attackerRolls -
defenderRolls -
retreats -
getBattleInfo(unitList,
rolls,
hitThreshold,
tacticalInput)
unitList -
rolls -
hitThreshold -
tacticalInput -
getBattleRolls(num,
asAttacker)
num -
asAttacker -
getBattleRoundHtml(attackerColor,
attackerRolls,
defenderRolls)
attackerColor -
attackerRolls -
defenderRolls -
getBattleStyle(needBorder,
unit)
needBorder -
unit -
getBombardHtml(attackerColor,
attackerRolls)
attackerColor -
attackerRolls -
Rectangle
getClipRect()
Gets the clipping rectangle for this piece based on its color value. #returns The clipping rectangle.
Overrides:getClipRect
in class Piece
getCommitToContinueBattleHtml(attackerColor,
start)
attackerColor -
start -
getCommitToPreBattleArtilleryFireHtml(attackerColor)
attackerColor -
getCommitToStartBattleHtml(attackerColor)
attackerColor -
getCommitToStartReserveBattleHtml(attackerColor)
attackerColor -
getDefenderHitPromts(hits,
tacticalHits)
hits -
tacticalHits -
getDefenderUnitList(color)
color -
getDiceHtml(rolls,
hitThreshold)
rolls -
hitThreshold -
getHighestHitUnit(color)
color -
getHiliteClipRect(border)
border -
getHitCountsForLogEntry(color,
enemy)
color -
enemy -
getHitEvent(needEvent,
unit,
areAttackers)
needEvent -
unit -
areAttackers -
getHitUnitsLogEntries(color)
color -
getLandRetreatables(color)
color -
getLowestOptionalHitUnit(color)
color -
getMemoryUnitsHtml(pieceCenter,
src)
pieceCenter -
src -
getMilitaryUnitCount(color)
color -
getMilitaryUnitHitValueList(unitList,
numHits)
unitList -
numHits -
getMilitaryUnitList(color)
color -
getNextOptionalHit(color)
color -
getNumAttackingHexes(color)
color -
getOkButtonPrompts(method,
attackerColor)
method -
attackerColor -
getOpponentColor(color)
color -
getPreBattleArtilleryFireHtml(attackerColor,
attackerRolls,
defenderRolls)
attackerColor -
attackerRolls -
defenderRolls -
getRetreatables(color)
color -
getRoadsOut(color,
rulerColor,
allowance)
color -
rulerColor -
allowance -
getRolls(attackerColor,
numSetsToAverage)
attackerColor -
numSetsToAverage -
getRotatedBoardValue()
getScore(color)
color -
Rectangle
getScreenRect(/*String
*/ boardPoint)
Gets the screen rectangle for this piece based on its boardPoint
property.
getScreenRect
in class Piece
boardPoint -(Optional) If provided, calculates with this value instead of its internal
boardPoint
property.
getSubjugatorRetreatables()
getTileIndexColors()
getUnitImageSrc()
getUnitListHtml(unitList,
areAttackers,
needBorder,
needEvent,
showAttackHexes)
unitList -
areAttackers -
needBorder -
needEvent -
showAttackHexes -
getUnitValue()
getUnitsListHtml(unitType,
pieceCenter,
src)
unitType -
pieceCenter -
src -
getUnknownRolls(num)
num -
getWaterRetreatables(color)
color -
hasAdjacentRollingEnemy(color,
rulerColor)
color -
rulerColor -
hasAllianceCivilization(color,
rulerColor)
color -
rulerColor -
hasAlliedCity(color,
rulerColor)
color -
rulerColor -
hasAlliedMilitary(color,
rulerColor)
color -
rulerColor -
hasAlliedUnit(color,
rulerColor)
color -
rulerColor -
hasArtillery(color)
color -
hasBattle(color,
rulerColor)
color -
rulerColor -
hasCapital(color)
color -
hasCavalry(color)
color -
hasCity(color)
color -
hasCivilization(color)
color -
hasDoomsdayClock(color)
color -
hasEnemy(color,
rulerColor)
color -
rulerColor -
hasFrigate(color)
color -
hasInfantry(color)
color -
hasLoadableUnit(color,
forRetreat)
color -
forRetreat -
hasMetropolis(color)
color -
hasMilitary(color)
color -
hasNavalSupport(color)
color -
hasNonRulingOpponentMilitary(color,
rulerColor)
color -
rulerColor -
hasOpponent(color)
color -
hasOpponentAllianceUnits(color,
rulerColor)
color -
rulerColor -
hasOpponentArtillery(color)
color -
hasOpponentCapital(color)
color -
hasOpponentCapital(color)
color -
hasOpponentCity(color)
color -
hasOpponentCivilization(color)
color -
hasOpponentMetropolis(color)
color -
hasOpponentPennant(color)
color -
hasOpponentTown(color)
color -
hasOpponentUnit(color,
unitType)
color -
unitType -
hasPennant(color)
color -
hasPreBattle(color)
color -
hasRelocatingCivilization(color)
color -
hasRollingEnemy(color,
rulerColor)
color -
rulerColor -
hasRollingOpponent(color)
color -
hasSubjugationFlag(color)
color -
hasTown(color)
color -
hasUnit(color,
unitType)
color -
unitType -
hasUnitAsCargo(color,
unitType)
color -
unitType -
hasUnitToBombard(color,
rulerColor)
color -
rulerColor -
hasUnloadableAdjacents(color)
color -
hitAllMilitaryUnits(unitList,
optional)
unitList -
optional -
hitHighestMilitaryUnits(unitList,
numToHit,
optional)
unitList -
numToHit -
optional -
hitLowestMilitaryUnits(unitList,
numToHit,
optional)
unitList -
numToHit -
optional -
hitUnitsByIndices(unitList,
indices,
optional)
unitList -
indices -
optional -
isBeingRevealed()
isBlockingTerrain()
isBuildable(color,
rulerColor)
color -
rulerColor -
isForest()
isGrassland()
isLand()
isMountain()
isPerimeter()
isPlain()
isPort(color)
color -
isRelocatable(color,
rulerColor,
oldPoint)
color -
rulerColor -
oldPoint -
isRoadable(color,
rulerColor)
color -
rulerColor -
isSlowTerrain(color,
rulerColor)
color -
rulerColor -
isUnloadable(color)
color -
isWater()
luckAverageAttacker(attackerHitThreshold,
attackerRolls,
numSetsToAverage)
attackerHitThreshold -
attackerRolls -
numSetsToAverage -
luckAverageRolls(hitThreshold,
rolls,
startIndex,
numSets)
hitThreshold -
rolls -
startIndex -
numSets -
maybeLuckAverageDefender(defenderHitThreshold,
defenderRolls,
defenderColor)
defenderHitThreshold -
defenderRolls -
defenderColor -
maybeStartDoomsdayClock(civ)
civ -
maybeSuppressDefender(defenderRolls,
defenderColor,
overkill)
defenderRolls -
defenderColor -
overkill -
militaryUnitFromScreenPoint(screenPoint,
unitType,
color,
rulerColor,
movers,
bombarders,
loadables,
retreatables,
cargoType,
redeployables)
screenPoint -
unitType -
color -
rulerColor -
movers -
bombarders -
loadables -
retreatables -
cargoType -
redeployables -
minDistanceTo(piece,
max,
mustBeVisible,
forRoad,
color,
rulerColor)
piece -
max -
mustBeVisible -
forRoad -
color -
rulerColor -
minDistanceToR(distance,
leastPossible,
piece,
max,
mustBeVisible,
forRoad,
color,
rulerColor)
distance -
leastPossible -
piece -
max -
mustBeVisible -
forRoad -
color -
rulerColor -
moveUnit(unit)
unit -
numAttackerRolls(color)
color -
numDefenderMilitaryRolls(opponentColor)
opponentColor -
numDefenderRolls(opponentColor)
opponentColor -
populateMilitaryUnitHitValueList(unitList,
hitList,
indexList,
startIndex,
numHits)
unitList -
hitList -
indexList -
startIndex -
numHits -
preBattleOkClick(color)
color -
pushBombardable(bombardables,
color,
rulerColor)
bombardables -
color -
rulerColor -
pushMoveable(movables,
color,
rulerColor,
distance,
retreatIndex)
movables -
color -
rulerColor -
distance -
retreatIndex -
remainingUnhitValue(unitList)
unitList -
removeAllUnits(update)
update -
removeHitUnits()
removeOpponentPennants(color,
update)
color -
update -
removePennant(color,
update)
color -
update -
removePennantsInEnemyLand(color,
enemyColor)
color -
enemyColor -
removeUnit(unit,
orphanedPennantToo)
unit -
orphanedPennantToo -
removeUnitAtIndex(index)
index -
resetTurnAttributes(color)
color -
setActiveUnit(unit)
unit -
setAllMilitaryMoveComplete(color,
update)
color -
update -
setAllianceColorBlind(color)
color -
setBattleOkButtonState()
setBorder(borderOn)
borderOn -
setHilite(hiliteOn)
hiliteOn -
setMovingUnit(unit)
unit -
setSubjugation(color,
rulerColor,
update)
color -
rulerColor -
update -
setUndark()
setUnitHit(unit,
hit,
optional)
unit -
hit -
optional -
setUnitValue(value)
value -
void
setVisibility(/*Boolean
*/ hidden)
Sets the 'temporary' visibility of a piece.
Overrides:setVisibility
in class Piece
hidden -Hides the piece.
void
snap(/*Point
*/ boardPoint,
/*String
*/ boardValueOverride)
Centers the piece on a board point. The boardPoint
property is not altered.
boardPoint -The board point on which to center.
boardValueOverride -(Optional) If provided, renders the piece with this value instead of its internal
value
property.
sortUnitList(unitList)
unitList -
subjugate(color)
color -
terrainDefenses()
terrianMatchesUnitType(unitType)
unitType -
unhitAllUnoptionalHits(color)
color -
unhitLowestOptionalHit(color)
color -
updateUnitDisplay()
updateUnitHitDisplay(unit)
unit -
upgradeTownToCity()
urbanDefenses(color)
color -
whackAllUnits(color,
unitType)
color -
unitType -
willSubjugate(color)
color -