Package net.sf.colossus.game
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 TypeMethodDescriptionint
computeSkillPenaltyRangestrikeThrough
(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 int
computeSkillPenaltyRangestrikeThroughDir
(BattleHex hex1, BattleHex hex2, Creature c, boolean left, int previousCount) int
countBrambleHexes
(BattleHex hex1, BattleHex hex2) Deprecated.another function with explicit reference to Bramble that should be fixed.private int
countBrambleHexesDir
(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 Legion
int
getCritter
(BattleHex hex) static int
getDirection
(BattleHex hex1, BattleHex hex2, boolean left) Return the hexside direction of the path from hex1 to hex2.getGame()
protected Legion
getLegionByPlayer
(Player player) static int
Return the range in hexes from hex1 to hex2.abstract boolean
isInContact
(BattleCritter striker, boolean countDead) boolean
isLOSBlocked
(BattleHex hex1, BattleHex hex2) Check to see if the LOS from hex1 to hex2 is blocked.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.protected static boolean
isObstacle
(char hexside) Deprecated.This is the realm of HazardEdge, not direct use of hexsideboolean
isOccupied
(BattleHex hex) protected boolean
isRangestrikePossible
(Creature critter, Creature target, BattleHex currentHex, BattleHex targetHex) Return true if the rangestrike is possible.private static int
minRangeToNeighbor
(BattleHex hex1, BattleHex hex2) Return the minimum range from any neighbor of hex1 to hex2.void
setBattleTurnNumber
(int battleTurnNumber) static boolean
toLeft
(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
Return the range in hexes from hex1 to hex2. Titan ranges are inclusive at both ends. -
minRangeToNeighbor
Return the minimum range from any neighbor of hex1 to hex2. -
isLOSBlocked
Check to see if the LOS from hex1 to hex2 is blocked. If the LOS lies along a hexspine, check both and return true only if both are blocked. -
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
protected boolean isRangestrikePossible(Creature critter, Creature target, BattleHex currentHex, BattleHex targetHex) Return true if the rangestrike is possible. -
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
-