|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.common.model.SimpleCombatModel
public class SimpleCombatModel
This class implements the original Colonization combat model.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface net.sf.freecol.common.model.CombatModel |
|---|
CombatModel.CombatOdds, CombatModel.CombatResult, CombatModel.CombatResultType |
| Field Summary | |
|---|---|
static java.lang.String |
ARTILLERY_AGAINST_RAID
|
static java.lang.String |
ARTILLERY_IN_THE_OPEN
|
static java.lang.String |
ATTACK_BONUS
|
static java.lang.String |
BIG_MOVEMENT_PENALTY
|
static java.lang.String |
FORTIFIED
|
private static java.util.logging.Logger |
logger
|
static int |
MAXIMUM_BOMBARD_POWER
The maximum attack power of a Colony's fortifications against a naval unit. |
static java.lang.String |
SMALL_MOVEMENT_PENALTY
|
| Constructor Summary | |
|---|---|
SimpleCombatModel()
|
|
| Method Summary | |
|---|---|
void |
attack(Unit attacker,
Unit defender,
CombatModel.CombatResult result,
int plunderGold,
Location repairLocation)
Attack a unit with the given outcome. |
void |
bombard(Colony colony,
Unit defender,
CombatModel.CombatResult result,
Location repairLocation)
Bombard a unit with the given outcome. |
CombatModel.CombatOdds |
calculateCombatOdds(Unit attacker,
Unit defender)
Calculates the chance of the outcomes of combat between the units. |
void |
captureColony(Unit attacker,
Colony colony,
int plunderGold,
Location repairLocation)
Captures an enemy colony and plunders gold. |
private void |
captureUnit(Unit unit,
Unit enemyUnit)
Capture a unit. |
private void |
damageAllShips(Colony colony,
Unit attacker,
Location repairLocation)
Damages all ship located on this Colony's
Tile. |
private void |
damageShip(Unit damagedShip,
Colony attackerColony,
Unit attackerUnit,
Location repairLocation)
Sets the damage to this ship and sends it to its repair location. |
private void |
demoteUnit(Unit unit,
UnitType downgrade,
Unit enemyUnit)
Demotes a unit. |
private void |
destroySettlement(Unit attacker,
IndianSettlement settlement)
Destroys an Indian settlement. |
private void |
disarmUnit(Unit unit,
EquipmentType typeToLose,
Unit enemyUnit)
Disarm a unit. |
private void |
enemyCapturesEquipment(Unit unit,
Unit enemyUnit,
EquipmentType typeToLose)
|
private void |
evade(Unit defender,
Colony attackerColony,
Unit attackerUnit)
Evade a naval engagement. |
private EquipmentType |
findEquipmentTypeToLose(Unit victim)
Find the highest priority equipment carried by a unit, if any |
CombatModel.CombatResult |
generateAttackResult(Colony colony,
Unit defender)
Generates the result of a colony bombarding a Unit. |
CombatModel.CombatResult |
generateAttackResult(Unit attacker,
Unit defender)
Generates a result of an attack. |
static java.lang.String |
getApparentOwnerName(Unit unit)
Get the name of the apparent owner of this Unit, (like getOwner().getNationAsString() but handles pirates) |
private void |
getConvert(Unit attacker,
IndianSettlement indianSettlement)
Check whether some indian converts due to the attack or they burn all missions |
float |
getDefencePower(Colony colony,
Unit defender)
Return the defensive power of the defender versus the bombarding colony. |
float |
getDefencePower(Unit attacker,
Unit defender)
Return the defensive power of the defender versus the attacker. |
java.util.Set<Modifier> |
getDefensiveModifiers(Colony colony,
Unit defender)
Return a list of all defensive modifiers that apply to the defender versus the bombarding colony. |
java.util.Set<Modifier> |
getDefensiveModifiers(Unit attacker,
Unit defender)
Return a list of all defensive modifiers that apply to the defender versus the attacker. |
float |
getOffencePower(Colony colony,
Unit defender)
Returns the power for bombarding |
float |
getOffencePower(Unit attacker,
Unit defender)
Return the offensive power of the attacker versus the defender. |
java.util.Set<Modifier> |
getOffensiveModifiers(Colony colony,
Unit defender)
Return a list of all offensive modifiers that apply to the attacker versus the defender. |
java.util.Set<Modifier> |
getOffensiveModifiers(Unit attacker,
Unit defender)
Return a list of all offensive modifiers that apply to the attacker versus the defender. |
private void |
loseCombat(Unit unit,
Unit enemyUnit)
Lose a combat. |
private boolean |
losingEquipDiscardsUnit(Unit unit,
EquipmentType typeToLose)
|
private void |
pillageColony(Unit attacker,
Colony colony,
Location repairLocation)
Damage a building or a ship or steal some goods or gold. |
private void |
promote(Unit unit)
Promotes this unit. |
private void |
sinkShip(Unit sinkingShip,
Colony attackerColony,
Unit attackerUnit)
Sinks this ship. |
private void |
slaughterUnit(Unit unit,
Unit enemyUnit)
Slaughter a unit. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
public static final int MAXIMUM_BOMBARD_POWER
public static final java.lang.String SMALL_MOVEMENT_PENALTY
public static final java.lang.String BIG_MOVEMENT_PENALTY
public static final java.lang.String ARTILLERY_IN_THE_OPEN
public static final java.lang.String ATTACK_BONUS
public static final java.lang.String FORTIFIED
public static final java.lang.String ARTILLERY_AGAINST_RAID
| Constructor Detail |
|---|
public SimpleCombatModel()
| Method Detail |
|---|
public static java.lang.String getApparentOwnerName(Unit unit)
unit - an Unit value
public CombatModel.CombatOdds calculateCombatOdds(Unit attacker,
Unit defender)
calculateCombatOdds in interface CombatModelattacker - The attacking Unit.defender - The defending unit.
CombatOdds value.
public CombatModel.CombatResult generateAttackResult(Unit attacker,
Unit defender)
generateAttackResult in interface CombatModelattacker - The Unit attacking.defender - The defending unit.
CombatResult value
public CombatModel.CombatResult generateAttackResult(Colony colony,
Unit defender)
generateAttackResult in interface CombatModelcolony - the bombarding Colonydefender - the defending Unit
CombatResult value
public float getOffencePower(Colony colony,
Unit defender)
getOffencePower in interface CombatModelcolony - a Colony valuedefender - an Unit value
public float getOffencePower(Unit attacker,
Unit defender)
getOffencePower in interface CombatModelattacker - an Unit valuedefender - an Unit value
float value
public java.util.Set<Modifier> getOffensiveModifiers(Colony colony,
Unit defender)
getOffensiveModifiers in interface CombatModelcolony - an Colony valuedefender - an Unit value
List of Modifiers
public java.util.Set<Modifier> getOffensiveModifiers(Unit attacker,
Unit defender)
getOffensiveModifiers in interface CombatModelattacker - an Unit valuedefender - an Unit value
List of Modifiers
public float getDefencePower(Colony colony,
Unit defender)
getDefencePower in interface CombatModelcolony - a Colony valuedefender - a Unit value
float value
public float getDefencePower(Unit attacker,
Unit defender)
getDefencePower in interface CombatModelattacker - an Unit valuedefender - an Unit value
float value
public java.util.Set<Modifier> getDefensiveModifiers(Colony colony,
Unit defender)
getDefensiveModifiers in interface CombatModelcolony - a Colony valuedefender - an Unit value
List of Modifiers
public java.util.Set<Modifier> getDefensiveModifiers(Unit attacker,
Unit defender)
getDefensiveModifiers in interface CombatModelattacker - an Unit valuedefender - an Unit value
List of Modifiers
public void attack(Unit attacker,
Unit defender,
CombatModel.CombatResult result,
int plunderGold,
Location repairLocation)
attack in interface CombatModelattacker - an Unit valuedefender - The Unit defending against attack.result - The result of the attack.plunderGold - an int valuerepairLocation - a Location value
public void bombard(Colony colony,
Unit defender,
CombatModel.CombatResult result,
Location repairLocation)
bombard in interface CombatModelcolony - a Colony valuedefender - The Unit defending against bombardment.result - The result of the bombardment.
public void captureColony(Unit attacker,
Colony colony,
int plunderGold,
Location repairLocation)
attacker - an Unit valuecolony - a Colony valueplunderGold - The amount of gold to plunder.
private void damageAllShips(Colony colony,
Unit attacker,
Location repairLocation)
Colony's
Tile. That is: they are sent to the closest location for
repair.
damageShip(net.sf.freecol.common.model.Unit, net.sf.freecol.common.model.Colony, net.sf.freecol.common.model.Unit, net.sf.freecol.common.model.Location)
private void pillageColony(Unit attacker,
Colony colony,
Location repairLocation)
colony - The attacked colony
private void destroySettlement(Unit attacker,
IndianSettlement settlement)
attacker - an Unit valuesettlement - an IndianSettlement value
private void getConvert(Unit attacker,
IndianSettlement indianSettlement)
indianSettlement - The attacked indian settlement
private void evade(Unit defender,
Colony attackerColony,
Unit attackerUnit)
defender - A naval unit that evades the attackerattackerColony - A colony that may have bombarded the defenderattackerUnit - A unit that may have attacked the defender
private void damageShip(Unit damagedShip,
Colony attackerColony,
Unit attackerUnit,
Location repairLocation)
damagedShip - A ship that is loosing a battle and getting damagedattackerColony - The colony that may have opened fire on this unitattackerUnit - A unit which may have damaged the ship
private void sinkShip(Unit sinkingShip,
Colony attackerColony,
Unit attackerUnit)
sinkingShip - the Unit that is going to sinkattackerColony - The colony that may have opened fire on this unitattackerUnit - The unit which may have attacked the shipprivate EquipmentType findEquipmentTypeToLose(Unit victim)
victim - a Unit that is about to lose equipment
EquipmentType carried by a
unit, or null if none.
private void loseCombat(Unit unit,
Unit enemyUnit)
unit - a Unit that has lost a combatenemyUnit - a Unit that has won a combat
private boolean losingEquipDiscardsUnit(Unit unit,
EquipmentType typeToLose)
private void captureUnit(Unit unit,
Unit enemyUnit)
unit - a Unit to be capturedenemyUnit - a Unit that is capturing
private void demoteUnit(Unit unit,
UnitType downgrade,
Unit enemyUnit)
unit - a Unit to demotedowngrade - the UnitType to downgrade the init toenemyUnit - a Unit that caused the demotion
private void disarmUnit(Unit unit,
EquipmentType typeToLose,
Unit enemyUnit)
unit - a Unit to be disarmedtypeToLose - the EquipmentType to loseenemyUnit - a Unit that is disarming
private void enemyCapturesEquipment(Unit unit,
Unit enemyUnit,
EquipmentType typeToLose)
private void slaughterUnit(Unit unit,
Unit enemyUnit)
unit - a Unit to slaughterenemyUnit - a Unit that is slaughteringprivate void promote(Unit unit)
unit - an Unit value
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||