net.sf.colossus.client
Class Strike

java.lang.Object
  extended by net.sf.colossus.client.Strike

public final class Strike
extends java.lang.Object

Class Strike holds client-side strike logic.

Author:
David Ripton, Romain Dolbeau

Field Summary
private  Client client
           
private static java.util.logging.Logger LOGGER
           
 
Constructor Summary
Strike(Client client)
           
 
Method Summary
 boolean canStrike(BattleCritter striker, BattleCritter target)
           
private  int countStrikes(BattleCritter battleUnit, boolean rangestrike)
           
(package private)  java.util.Set<BattleHex> findCrittersWithTargets()
          Return the set of hexes with critters that have valid strike targets.
private  java.util.Set<BattleHex> findStrikes(BattleCritter battleUnit, boolean rangestrike)
          Return a set of hexes containing targets that the critter may strike.
(package private)  java.util.Set<BattleHex> findStrikes(int tag)
           
private  boolean isLOSBlocked(BattleHex hex1, BattleHex hex2)
          Deprecated. Should use an extension of Battle instead of Strike
private  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)
          Deprecated. Should use an extension of Battle instead of Strike
(package private) static boolean isObstacle(char hexside)
          Deprecated. 
private  boolean isRangestrikePossible(BattleCritter striker, BattleCritter target)
          Deprecated. 
(package private)  boolean makeForcedStrikes(boolean rangestrike)
          Perform strikes for any creature that is forced to strike and has only one legal target.
 int minRangeToEnemy(BattleCritter battleUnit)
          Deprecated. Should use an extension of Battle instead of Strike
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final java.util.logging.Logger LOGGER

client

private final Client client
Constructor Detail

Strike

Strike(Client client)
Method Detail

findCrittersWithTargets

java.util.Set<BattleHex> findCrittersWithTargets()
Return the set of hexes with critters that have valid strike targets.


makeForcedStrikes

boolean makeForcedStrikes(boolean rangestrike)
Perform strikes for any creature that is forced to strike and has only one legal target. Forced strikes will never generate carries, since there's only one target. If rangestrike is true, also perform rangestrikes for creatures with only one target, even though they're not technically forced. Return after one strike, so the client can wait for status from the server. XXX This method does stuff, rather than just returning information, unlike the rest of the Strike class. Returns true if a strike was made.


canStrike

public boolean canStrike(BattleCritter striker,
                         BattleCritter target)

findStrikes

java.util.Set<BattleHex> findStrikes(int tag)

findStrikes

private java.util.Set<BattleHex> findStrikes(BattleCritter battleUnit,
                                             boolean rangestrike)
Return a set of hexes containing targets that the critter may strike. Only include rangestrikes if rangestrike is true.


countStrikes

private int countStrikes(BattleCritter battleUnit,
                         boolean rangestrike)

minRangeToEnemy

@Deprecated
public int minRangeToEnemy(BattleCritter battleUnit)
Deprecated. Should use an extension of Battle instead of Strike

Return the titan range (inclusive at both ends) from the critter to the closest enemy critter. Return OUT_OF_RANGE if there are none. WARNING: this is a duplication from code in Battle ; caller should use a Battle instance instead.


isObstacle

@Deprecated
static boolean isObstacle(char hexside)
Deprecated. 


isLOSBlockedDir

@Deprecated
private 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)
Deprecated. Should use an extension of Battle instead of Strike

Check LOS, going to the left of hexspines if argument left is true, or to the right if it is false. WARNING: this is a duplication from code in Battle ; caller should use a Battle instance instead.


isLOSBlocked

@Deprecated
private boolean isLOSBlocked(BattleHex hex1,
                                        BattleHex hex2)
Deprecated. Should use an extension of Battle instead of Strike

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. WARNING: this is a duplication from code in Battle ; caller should use a Battle instance instead.


isRangestrikePossible

@Deprecated
private boolean isRangestrikePossible(BattleCritter striker,
                                                 BattleCritter target)
Deprecated. 

Return true if the rangestrike is possible.