net.sf.colossus.client
Class BattleClientSide

java.lang.Object
  extended by net.sf.colossus.game.Battle
      extended by net.sf.colossus.client.BattleClientSide

public class BattleClientSide
extends Battle


Field Summary
private  Player battleActivePlayer
           
private  BattlePhase battlePhase
           
private  int battleTurnNumber
           
private  java.util.List<BattleUnit> battleUnits
           
private static java.util.logging.Logger LOGGER
           
 
Fields inherited from class net.sf.colossus.game.Battle
attacker, defender, game
 
Constructor Summary
BattleClientSide(Game game, Legion attacker, Legion defender, MasterHex location)
           
 
Method Summary
 boolean anyOffboardCreatures()
           
 void cleanupBattle()
           
 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.
 BattleUnit createBattleUnit(java.lang.String imageName, boolean inverted, int tag, BattleHex hex, CreatureType type, Legion legion)
           
 java.util.List<BattleUnit> getActiveBattleUnits()
           
private  int getAttackerSkill(BattleCritter striker, BattleCritter target, Client client)
          WARNING: this is duplicated in CreatureServerSide (moved from Strike to here)
 Legion getBattleActiveLegion()
           
 Player getBattleActivePlayer()
           
 BattlePhase getBattlePhase()
           
 java.lang.String getBattlePhaseName()
           
 int getBattleTurnNumber()
           
 BattleUnit getBattleUnit(BattleHex hex)
           
(package private)  BattleUnit getBattleUnit(int tag)
          Get the BattleUnit with this tag.
 java.util.List<BattleUnit> getBattleUnits()
           
 java.util.List<BattleUnit> getBattleUnits(BattleHex hex)
           
 int getDice(BattleCritter battleUnit, BattleCritter target, Client client)
          Return the number of dice that will be rolled when striking this target, including modifications for terrain.
 GameClientSide getGameClientSide()
           
 java.util.List<BattleUnit> getInactiveBattleUnits()
           
 int getStrikeNumber(BattleCritter striker, BattleCritter target, Client client)
          WARNING: this is duplicated in CreatureServerSide (moved from Strike to here)
 void init(int battleTurnNumber, Player battleActivePlayer, BattlePhase battlePhase)
           
 boolean isBattlePhase(BattlePhase phase)
           
protected  boolean isOccupied(BattleHex hex)
          Whether the hex is occupied by a critter/creature/chit/...
 void markOffboardCreaturesDead()
           
 void removeDeadBattleChits()
           
 void resetAllBattleMoves()
           
 void setBattleActivePlayer(Player battleActivePlayer)
           
 void setBattlePhase(BattlePhase battlePhase)
           
 void setBattleTurnNumber(int battleTurnNumber)
           
 void setupBattleFight(BattlePhase battlePhase, Player battleActivePlayer)
           
 void setupPhase(BattlePhase phase, Player battleActivePlayer, int battleTurnNumber)
           
 
Methods inherited from class net.sf.colossus.game.Battle
computeSkillPenaltyRangestrikeThrough, getAttackingLegion, getDefendingLegion, getDirection, getGame, getLegionByPlayer, getLocation, getRange, isLOSBlocked, isLOSBlockedDir, isRangestrikePossible, toLeft
 
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

battlePhase

private BattlePhase battlePhase

battleTurnNumber

private int battleTurnNumber

battleActivePlayer

private Player battleActivePlayer

battleUnits

private final java.util.List<BattleUnit> battleUnits
Constructor Detail

BattleClientSide

public BattleClientSide(Game game,
                        Legion attacker,
                        Legion defender,
                        MasterHex location)
Method Detail

init

public void init(int battleTurnNumber,
                 Player battleActivePlayer,
                 BattlePhase battlePhase)

isOccupied

protected boolean isOccupied(BattleHex hex)
Description copied from class: Battle
Whether the hex is occupied by a critter/creature/chit/... This is abstract because the specific information about critter/... is currently kept in the subclass, but this information is required by several helper function located in the Battle class.

Specified by:
isOccupied in class Battle
Parameters:
hex - The hex whose occupancy is being checked
Returns:
Whether the hex is occupied by a critter/creature/chit/...

getGameClientSide

public GameClientSide getGameClientSide()

setBattleTurnNumber

public void setBattleTurnNumber(int battleTurnNumber)

getBattleTurnNumber

public int getBattleTurnNumber()

getBattleActivePlayer

public Player getBattleActivePlayer()

cleanupBattle

public void cleanupBattle()

getBattleActiveLegion

public Legion getBattleActiveLegion()

getBattlePhase

public BattlePhase getBattlePhase()

setBattlePhase

public void setBattlePhase(BattlePhase battlePhase)

isBattlePhase

public boolean isBattlePhase(BattlePhase phase)

setupPhase

public void setupPhase(BattlePhase phase,
                       Player battleActivePlayer,
                       int battleTurnNumber)

getBattlePhaseName

public java.lang.String getBattlePhaseName()

setBattleActivePlayer

public void setBattleActivePlayer(Player battleActivePlayer)

setupBattleFight

public void setupBattleFight(BattlePhase battlePhase,
                             Player battleActivePlayer)

createBattleUnit

public BattleUnit createBattleUnit(java.lang.String imageName,
                                   boolean inverted,
                                   int tag,
                                   BattleHex hex,
                                   CreatureType type,
                                   Legion legion)

anyOffboardCreatures

public boolean anyOffboardCreatures()

getActiveBattleUnits

public java.util.List<BattleUnit> getActiveBattleUnits()

getInactiveBattleUnits

public java.util.List<BattleUnit> getInactiveBattleUnits()

getBattleUnits

public java.util.List<BattleUnit> getBattleUnits()

getBattleUnits

public java.util.List<BattleUnit> getBattleUnits(BattleHex hex)

getBattleUnit

public BattleUnit getBattleUnit(BattleHex hex)

getBattleUnit

BattleUnit getBattleUnit(int tag)
Get the BattleUnit with this tag.


resetAllBattleMoves

public void resetAllBattleMoves()

markOffboardCreaturesDead

public void markOffboardCreaturesDead()

removeDeadBattleChits

public void removeDeadBattleChits()

getDice

public int getDice(BattleCritter battleUnit,
                   BattleCritter target,
                   Client client)
Return the number of dice that will be rolled when striking this target, including modifications for terrain. WARNING: this is duplicated in CreatureServerSide (moved from Strike to here)


getAttackerSkill

private int getAttackerSkill(BattleCritter striker,
                             BattleCritter target,
                             Client client)
WARNING: this is duplicated in CreatureServerSide (moved from Strike to here)


getStrikeNumber

public int getStrikeNumber(BattleCritter striker,
                           BattleCritter target,
                           Client client)
WARNING: this is duplicated in CreatureServerSide (moved from Strike to here)


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
public int countBrambleHexes(BattleHex hex1,
                                        BattleHex hex2)
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.