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.
|
Constructor Summary |
BattleMatching(java.util.Collection armies1,
java.util.Collection armies2,
Square _square)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fireSupport1
float fireSupport1
fireSupport2
float fireSupport2
BattleMatching
public BattleMatching(java.util.Collection armies1,
java.util.Collection armies2,
Square _square)
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.