|
||||||||||
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
|
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. |
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) |
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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 CombatModel
attacker
- The attacking Unit
.defender
- The defending unit.
CombatOdds
value.public CombatModel.CombatResult generateAttackResult(Unit attacker, Unit defender)
generateAttackResult
in interface CombatModel
attacker
- The Unit
attacking.defender
- The defending unit.
CombatResult
valuepublic CombatModel.CombatResult generateAttackResult(Colony colony, Unit defender)
generateAttackResult
in interface CombatModel
colony
- the bombarding Colony
defender
- the defending Unit
CombatResult
valuepublic float getOffencePower(Colony colony, Unit defender)
getOffencePower
in interface CombatModel
colony
- a Colony
valuedefender
- an Unit
value
public float getOffencePower(Unit attacker, Unit defender)
getOffencePower
in interface CombatModel
attacker
- an Unit
valuedefender
- an Unit
value
float
valuepublic java.util.Set<Modifier> getOffensiveModifiers(Colony colony, Unit defender)
getOffensiveModifiers
in interface CombatModel
colony
- an Colony
valuedefender
- an Unit
value
List
of Modifierspublic java.util.Set<Modifier> getOffensiveModifiers(Unit attacker, Unit defender)
getOffensiveModifiers
in interface CombatModel
attacker
- an Unit
valuedefender
- an Unit
value
List
of Modifierspublic float getDefencePower(Colony colony, Unit defender)
getDefencePower
in interface CombatModel
colony
- a Colony
valuedefender
- a Unit
value
float
valuepublic float getDefencePower(Unit attacker, Unit defender)
getDefencePower
in interface CombatModel
attacker
- an Unit
valuedefender
- an Unit
value
float
valuepublic java.util.Set<Modifier> getDefensiveModifiers(Colony colony, Unit defender)
getDefensiveModifiers
in interface CombatModel
colony
- a Colony
valuedefender
- an Unit
value
List
of Modifierspublic java.util.Set<Modifier> getDefensiveModifiers(Unit attacker, Unit defender)
getDefensiveModifiers
in interface CombatModel
attacker
- an Unit
valuedefender
- an Unit
value
List
of Modifierspublic void attack(Unit attacker, Unit defender, CombatModel.CombatResult result, int plunderGold, Location repairLocation)
attack
in interface CombatModel
attacker
- an Unit
valuedefender
- The Unit
defending against attack.result
- The result of the attack.plunderGold
- an int
valuerepairLocation
- a Location
valuepublic void bombard(Colony colony, Unit defender, CombatModel.CombatResult result, Location repairLocation)
bombard
in interface CombatModel
colony
- 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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |