game.military
Class BattleMatching

java.lang.Object
  |
  +--game.military.BattleMatching

public class BattleMatching
extends java.lang.Object

Battle matching is the way two armies organize themselves to fight one another: How they put front line, support and reserve units. The actual fight is also in there.


Field Summary
(package private)  float fireSupport1
           
(package private)  float fireSupport2
           
 
Constructor Summary
BattleMatching(java.util.Collection armies1, java.util.Collection armies2, Square _square)
           
 
Method Summary
(package private) static float appraiseStrength(java.util.Iterator elements)
           
 boolean combat(float fireBonus, float fortBonus)
          Deal the damage.
 void fireSupport()
          Divides fire support.
 Civilization winner()
          Returns the winner civ.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fireSupport1

float fireSupport1

fireSupport2

float fireSupport2
Constructor Detail

BattleMatching

public BattleMatching(java.util.Collection armies1,
                      java.util.Collection armies2,
                      Square _square)
Method Detail

appraiseStrength

static float appraiseStrength(java.util.Iterator elements)

fireSupport

public void fireSupport()
Divides fire support. Also takes care of counter-battery fire.


combat

public boolean combat(float fireBonus,
                      float fortBonus)
Deal the damage. Splitting of element lines and partial combat go herein.

Returns:
false if no fight occurred (everyone fled) or the fight lasted more than a day/arbitrary number of iterations.

winner

public Civilization winner()
Returns the winner civ. The defender is supposed to have won if the attacker fled or died: Also, if either side has too bad odds to continue fighting, it is considered a loser. null is returned if the fight is not ended.