Class Battle
java.lang.Object
net.sf.colossus.game.Battle
- Direct Known Subclasses:
BattleClientSide, BattleServerSide
An ongoing battle.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcomputeSkillPenaltyRangestrikeThrough(BattleHex hex1, BattleHex hex2, Creature c) Compute the minimum Skill penalty that the creature will endure to rangestrike from hex1 to a creature in hex2 from the intervening hex.private intcomputeSkillPenaltyRangestrikeThroughDir(BattleHex hex1, BattleHex hex2, Creature c, boolean left, int previousCount) intcountBrambleHexes(BattleHex hex1, BattleHex hex2) Deprecated.another function with explicit reference to Bramble that should be fixed.private intcountBrambleHexesDir(BattleHex hex1, BattleHex hex2, boolean left, int previousCount) Deprecated.another function with explicit reference to Bramble that should be fixed.protected abstract List<BattleCritter> Get all BattleCritters / BattleUnits Abstract because currently implementation is different, but needed on both side, e.g.abstract LegionintgetCritter(BattleHex hex) static intgetDirection(BattleHex hex1, BattleHex hex2, boolean left) Return the hexside direction of the path from hex1 to hex2.getGame()protected LegiongetLegionByPlayer(Player player) static intReturn the range in hexes from hex1 to hex2.abstract booleanisInContact(BattleCritter striker, boolean countDead) booleanisLOSBlocked(BattleHex hex1, BattleHex hex2) Check to see if the LOS from hex1 to hex2 is blocked.protected booleanisLOSBlockedDir(BattleHex initialHex, BattleHex currentHex, BattleHex finalHex, boolean left, int strikeElevation, boolean strikerAtop, boolean strikerAtopCliff, boolean strikerAtopWall, boolean midObstacle, boolean midCliff, boolean midChit, int totalObstacles, int totalWalls) Check LOS, going to the left of hexspines if argument left is true, or to the right if it is false.protected static booleanisObstacle(char hexside) Deprecated.This is the realm of HazardEdge, not direct use of hexsidebooleanisOccupied(BattleHex hex) protected booleanisRangestrikePossible(Creature critter, Creature target, BattleHex currentHex, BattleHex targetHex) Return true if the rangestrike is possible.private static intminRangeToNeighbor(BattleHex hex1, BattleHex hex2) Return the minimum range from any neighbor of hex1 to hex2.voidsetBattleTurnNumber(int battleTurnNumber) static booleantoLeft(double xDist, double yDist) Caller must ensure that yDist != 0 TODO Temporarily public because n.s.c.client.Strike needs it
-
Field Details
-
LOGGER
-
game
-
attacker
-
defender
-
location
-
battleTurnNumber
protected int battleTurnNumber
-
-
Constructor Details
-
Battle
-
-
Method Details
-
getGame
-
getAttackingLegion
-
getDefendingLegion
-
toLeft
public static boolean toLeft(double xDist, double yDist) Caller must ensure that yDist != 0 TODO Temporarily public because n.s.c.client.Strike needs it -
getDirection
Return the hexside direction of the path from hex1 to hex2. Sometimes two directions are possible. If the left parameter is set, the direction further left will be given. Otherwise, the direction further right will be given. -
countBrambleHexesDir
@Deprecated private int countBrambleHexesDir(BattleHex hex1, BattleHex hex2, boolean left, int previousCount) Deprecated.another function with explicit reference to Bramble that should be fixed.Return the number of intervening bramble hexes. If LOS is along a hexspine, go left if argument left is true, right otherwise. If LOS is blocked, return a large number. -
countBrambleHexes
Deprecated.another function with explicit reference to Bramble that should be fixed.Return the number of intervening bramble hexes. If LOS is along a hexspine and there are two choices, pick the lower one. -
isObstacle
Deprecated.This is the realm of HazardEdge, not direct use of hexside -
getRange
-
minRangeToNeighbor
-
isLOSBlocked
-
isLOSBlockedDir
protected boolean isLOSBlockedDir(BattleHex initialHex, BattleHex currentHex, BattleHex finalHex, boolean left, int strikeElevation, boolean strikerAtop, boolean strikerAtopCliff, boolean strikerAtopWall, boolean midObstacle, boolean midCliff, boolean midChit, int totalObstacles, int totalWalls) Check LOS, going to the left of hexspines if argument left is true, or to the right if it is false. -
isRangestrikePossible
-
computeSkillPenaltyRangestrikeThroughDir
-
computeSkillPenaltyRangestrikeThrough
Compute the minimum Skill penalty that the creature will endure to rangestrike from hex1 to a creature in hex2 from the intervening hex.- Parameters:
hex1- The hex in which the rangestriker sithex2- The hex in which the rangestruck sitc- The rangestriker- Returns:
- The penalty to the Skill Factor of the rangestriker from intervening hex.
-
getLegionByPlayer
-
getLocation
-
setBattleTurnNumber
public void setBattleTurnNumber(int battleTurnNumber) -
getBattleTurnNumber
public int getBattleTurnNumber() -
getCritter
-
isOccupied
-
getBattleActiveLegion
-
getAllCritters
Get all BattleCritters / BattleUnits Abstract because currently implementation is different, but needed on both side, e.g. for BattleMovement -
isInContact
-