Package net.sf.colossus.variant
Class HazardTerrain
java.lang.Object
net.sf.colossus.variant.Hazards
net.sf.colossus.variant.HazardTerrain
- All Implemented Interfaces:
HazardConstants
This is a typesafe enumeration of all hazard terrains, i.e. the
terrains used in the battle maps.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.sf.colossus.variant.Hazards
Hazards.CombatEffect
Nested classes/interfaces inherited from interface net.sf.colossus.variant.HazardConstants
HazardConstants.EffectOnMovement, HazardConstants.EffectOnStrike, HazardConstants.RangeStrikeSpecialEffect, HazardConstants.ScopeOfEffectOnStrike, HazardConstants.SpecialEffect
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final HazardTerrain
static final HazardTerrain
(package private) static final HazardTerrain
(package private) static final HazardTerrain
Only waterdweller can enter a lake, but anybody can fly over it.private static final Logger
(package private) static final HazardTerrain
(package private) static final HazardTerrain
(package private) static final HazardTerrain
static final HazardTerrain
Stone native gains 1 skill when defending against non-native ; Stone cannot be entered by non-native.(package private) static final HazardTerrain
private static final Map
<String, HazardTerrain> A map from the serialization string of a terrain to the instances.(package private) static final HazardTerrain
(package private) static final HazardTerrain
Tree is a genuine Titan hazard, but the effect on anybody inside is custom, as noone can enter a tree in Titan.static final HazardTerrain
Fields inherited from class net.sf.colossus.variant.Hazards
attackEffect, defenseEffect, effectOnFlyerMovement, effectOnGroundMovement, rangedAttackEffect, rangedDefenseEffect, rangeStrikeSpecial, terrainSpecial
-
Constructor Summary
ConstructorsConstructorDescriptionHazardTerrain
(String name, char code, HazardConstants.EffectOnMovement effectOnGroundMovement, HazardConstants.EffectOnMovement effectOnFlyerMovement, Hazards.CombatEffect defenseEffect, Hazards.CombatEffect attackEffect, Hazards.CombatEffect rangedDefenseEffect, Hazards.CombatEffect rangedAttackEffect, HazardConstants.RangeStrikeSpecialEffect RangeStrikeSpecial, HazardConstants.SpecialEffect terrainSpecial) -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
boolean
Whether this terrain blocks rangestrike.private int
computeSkillOrPowerBonus
(boolean firstIsNative, boolean secondIsNative, Hazards.CombatEffect effect, HazardConstants.EffectOnStrike whichIsBonus, HazardConstants.EffectOnStrike whichIsPenalty) Do the real computation of the bonus (negative if penalty).static final Collection
<HazardTerrain> Returns all available hazard terrains.static HazardTerrain
int
getPowerBonusRangestrikeFrom
(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature rangestriking out from that terrain on a unspecified creature.int
getPowerBonusRangestruckIn
(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature Rangestruck in this terrain by a unspecified creature.int
getPowerBonusStrikeFrom
(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature striking out from that terrain on a unspecified creature.int
getPowerBonusStruckIn
(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature struck in this terrain by a unspecified creature.int
getPowerPenaltyRangestrikeFrom
(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Power Factor of a creature rangestriking out from that terrain on a unspecified creature.int
getPowerPenaltyRangestruckIn
(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Strike Factor of a creature Rangestruck in this terrain by a unspecified creature.int
getPowerPenaltyStrikeFrom
(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Power Factor of a creature striking out from that terrain on a unspecified creature.int
getPowerPenaltyStruckIn
(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Strike Factor of a creature struck in this terrain by a unspecified creature.int
getSkillBonusRangestrikeFrom
(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature rangestriking out from that terrain.int
getSkillBonusRangestrikeThrough
(boolean rangestrikerIsNative) Return the bonus to apply to the Strike Factor of a Creature whose line-of-fire cross this hex.int
getSkillBonusRangestruckIn
(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature Rangestruck in this terrain.int
getSkillBonusStrikeFrom
(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature striking out from that terrain.int
getSkillBonusStruckIn
(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature struck in this terrain.int
getSkillPenaltyRangestrikeFrom
(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Strike Factor of a creature rangestriking out from that terrain.int
getSkillPenaltyRangestrikeThrough
(boolean rangestrikerIsNative) Return the penalty to apply to the Strike Factor of a Creature whose line-of-fire cross this hex.int
getSkillPenaltyRangestruckIn
(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Strike Factor of a creature Rangestruck in this terrain.int
getSkillPenaltyStrikeFrom
(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Strike Factor of a creature striking out from that terrain.int
getSkillPenaltyStruckIn
(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Strike Factor of a creature struck in this terrain.static HazardTerrain
getTerrainByName
(String name) Get the HazardTerrain by its name.boolean
Whether this terrain is damaging to non-native.boolean
Whether this terrain is damaging to water dweller.boolean
boolean
boolean
Whether this terrain is healingboolean
boolean
boolean
isPlains()
USE ONLY FOR BATTLELANDBUILDER!boolean
isSand()
USE ONLY FOR BATTLELANDBUILDER!boolean
Whether this terrain slows for the duration of the battleboolean
slows
(boolean isNative, boolean isFlyer) boolean
slowsFlyer
(boolean isNative) boolean
slowsGround
(boolean isNative) toString()
-
Field Details
-
LOGGER
-
TERRAIN_MAP
A map from the serialization string of a terrain to the instances. -
PLAINS
-
TREE
Tree is a genuine Titan hazard, but the effect on anybody inside is custom, as noone can enter a tree in Titan. For Colossus, native defending in a Tree against a non-native gains 1 Skill. It blocks rangestrike through it, but not to it. -
BRAMBLES
-
DRIFT
-
VOLCANO
-
BOG
-
SAND
-
TOWER
-
LAKE
Only waterdweller can enter a lake, but anybody can fly over it. No effect on combat. -
STONE
Stone native gains 1 skill when defending against non-native ; Stone cannot be entered by non-native. No rangestrike can traverse a Stone. -
SPRING
-
TARPIT
-
-
Constructor Details
-
HazardTerrain
public HazardTerrain(String name, char code, HazardConstants.EffectOnMovement effectOnGroundMovement, HazardConstants.EffectOnMovement effectOnFlyerMovement, Hazards.CombatEffect defenseEffect, Hazards.CombatEffect attackEffect, Hazards.CombatEffect rangedDefenseEffect, Hazards.CombatEffect rangedAttackEffect, HazardConstants.RangeStrikeSpecialEffect RangeStrikeSpecial, HazardConstants.SpecialEffect terrainSpecial)
-
-
Method Details
-
isNativeBonusTerrain
public boolean isNativeBonusTerrain() -
isNonNativePenaltyTerrain
public boolean isNonNativePenaltyTerrain() -
getTerrainByName
Get the HazardTerrain by its name. Ideally, this shouldn't be used anywhere but in the Variant code at load-time, thus becoming package private.- Parameters:
name
- The name of the terrain to access.- Returns:
- The terrain of the requested name.
-
getDefaultTerrain
-
getAllHazardTerrains
Returns all available hazard terrains. This is not variant-specific, any terrain known to the program is listed even if it is not available in the current variant. TODO this should really be a question to ask a variant instance -
toString
- Specified by:
toString
in interfaceHazardConstants
- Specified by:
toString
in classHazards
-
blocksFlyers
public boolean blocksFlyers() -
blocksGround
public boolean blocksGround() -
isFlyersNativeOnly
public boolean isFlyersNativeOnly() -
isGroundNativeOnly
public boolean isGroundNativeOnly() -
slowsGround
public boolean slowsGround(boolean isNative) -
slowsFlyer
public boolean slowsFlyer(boolean isNative) -
slows
public boolean slows(boolean isNative, boolean isFlyer) -
computeSkillOrPowerBonus
private int computeSkillOrPowerBonus(boolean firstIsNative, boolean secondIsNative, Hazards.CombatEffect effect, HazardConstants.EffectOnStrike whichIsBonus, HazardConstants.EffectOnStrike whichIsPenalty) Do the real computation of the bonus (negative if penalty).- Parameters:
firstIsNative
- Whether the first creature (attacker for attack skill/power, defender for defense skill/power) is native heresecondIsNative
- Whether the second creature is native hereeffect
- The effect to usewhichIsBonus
- Which effect is a bonus (power || skill)whichIsPenalty
- Which effect is a penalty (power || skill)scope
- The scope to useovalue
- The original adjustment of the effect- Returns:
- The final attacking or defending skill or power
-
getSkillBonusStrikeFrom
public int getSkillBonusStrikeFrom(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature striking out from that terrain.- Parameters:
attackerIsNative
- Whether the attacker is native from this HazardTerraindefenderIsNative
- Whether the defender is native from this HazardTerrain- Returns:
- The amount of bonus to apply (negative if it's a penalty).
-
getSkillPenaltyStrikeFrom
public int getSkillPenaltyStrikeFrom(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Strike Factor of a creature striking out from that terrain.- Parameters:
attackerIsNative
- Whether the attacker is native from this HazardTerraindefenderIsNative
- Whether the defender is native from this HazardTerrain- Returns:
- The amount of penalty to apply (negative if it's a bonus).
- See Also:
-
getSkillBonusStruckIn
public int getSkillBonusStruckIn(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature struck in this terrain.- Parameters:
attackerIsNative
- Whether the attacker is native from this HazardTerraindefenderIsNative
- Whether the defender is native from this HazardTerrain- Returns:
- The amount of bonus to apply (negative if it's a penalty).
-
getSkillPenaltyStruckIn
public int getSkillPenaltyStruckIn(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Strike Factor of a creature struck in this terrain.- Parameters:
attackerIsNative
- Whether the attacker is native from this HazardTerraindefenderIsNative
- Whether the defender is native from this HazardTerrain- Returns:
- The amount of penalty to apply (negative if it's a bonus).
-
getPowerBonusStrikeFrom
public int getPowerBonusStrikeFrom(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature striking out from that terrain on a unspecified creature.- Parameters:
attackerIsNative
- Whether the attacker is native from this HazardTerraindefenderIsNative
- Whether the defender is native from this HazardTerrain- Returns:
- The amount of bonus to apply (negative if it's a penalty).
-
getPowerPenaltyStrikeFrom
public int getPowerPenaltyStrikeFrom(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Power Factor of a creature striking out from that terrain on a unspecified creature.- Parameters:
attackerIsNative
- Whether the attacker is native from this HazardTerraindefenderIsNative
- Whether the defender is native from this HazardTerrain- Returns:
- The amount of penalty to apply (negative if it's a bonus).
-
getPowerBonusStruckIn
public int getPowerBonusStruckIn(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature struck in this terrain by a unspecified creature.- Parameters:
attackerIsNative
- Whether the attacker is native from this HazardTerraindefenderIsNative
- Whether the defender is native from this HazardTerrain- Returns:
- The amount of bonus to apply (negative if it's a penalty).
-
getPowerPenaltyStruckIn
public int getPowerPenaltyStruckIn(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Strike Factor of a creature struck in this terrain by a unspecified creature.- Parameters:
attackerIsNative
- Whether the attacker is native from this HazardTerraindefenderIsNative
- Whether the defender is native from this HazardTerrain- Returns:
- The amount of penalty to apply (negative if it's a bonus).
-
getSkillBonusRangestrikeFrom
public int getSkillBonusRangestrikeFrom(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature rangestriking out from that terrain.- Parameters:
attackerIsNative
- Whether the attacker is native from this HazardTerraindefenderIsNative
- Whether the defender is native from this HazardTerrain- Returns:
- The amount of bonus to apply (negative if it's a penalty).
-
getSkillPenaltyRangestrikeFrom
public int getSkillPenaltyRangestrikeFrom(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Strike Factor of a creature rangestriking out from that terrain.- Parameters:
attackerIsNative
- Whether the attacker is native from this HazardTerraindefenderIsNative
- Whether the defender is native from this HazardTerrain- Returns:
- The amount of penalty to apply (negative if it's a bonus).
- See Also:
-
getSkillBonusRangestruckIn
public int getSkillBonusRangestruckIn(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature Rangestruck in this terrain.- Parameters:
attackerIsNative
- Whether the attacker is native from this HazardTerraindefenderIsNative
- Whether the defender is native from this HazardTerrain- Returns:
- The amount of bonus to apply (negative if it's a penalty).
-
getSkillPenaltyRangestruckIn
public int getSkillPenaltyRangestruckIn(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Strike Factor of a creature Rangestruck in this terrain.- Parameters:
attackerIsNative
- Whether the attacker is native from this HazardTerraindefenderIsNative
- Whether the defender is native from this HazardTerrain- Returns:
- The amount of penalty to apply (negative if it's a bonus).
-
getPowerBonusRangestrikeFrom
public int getPowerBonusRangestrikeFrom(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature rangestriking out from that terrain on a unspecified creature.- Parameters:
attackerIsNative
- Whether the attacker is native from this HazardTerraindefenderIsNative
- Whether the defender is native from this HazardTerrain- Returns:
- The amount of bonus to apply (negative if it's a penalty).
-
getPowerPenaltyRangestrikeFrom
public int getPowerPenaltyRangestrikeFrom(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Power Factor of a creature rangestriking out from that terrain on a unspecified creature.- Parameters:
attackerIsNative
- Whether the attacker is native from this HazardTerraindefenderIsNative
- Whether the defender is native from this HazardTerrain- Returns:
- The amount of penalty to apply (negative if it's a bonus).
-
getPowerBonusRangestruckIn
public int getPowerBonusRangestruckIn(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature Rangestruck in this terrain by a unspecified creature.- Parameters:
attackerIsNative
- Whether the attacker is native from this HazardTerraindefenderIsNative
- Whether the defender is native from this HazardTerrain- Returns:
- The amount of bonus to apply (negative if it's a penalty).
-
getPowerPenaltyRangestruckIn
public int getPowerPenaltyRangestruckIn(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Strike Factor of a creature Rangestruck in this terrain by a unspecified creature.- Parameters:
attackerIsNative
- Whether the attacker is native from this HazardTerraindefenderIsNative
- Whether the defender is native from this HazardTerrain- Returns:
- The amount of penalty to apply (negative if it's a bonus).
-
blocksLineOfSight
public boolean blocksLineOfSight()Whether this terrain blocks rangestrike.- Returns:
- Whether this terrain blocks rangestrike.
-
isHealing
public boolean isHealing()Whether this terrain is healing- Returns:
- Whether this terrain is healing
-
isSlowingToNonNative
public boolean isSlowingToNonNative()Whether this terrain slows for the duration of the battle- Returns:
- Whether this terrain slows for the duration of the battle
-
isDamagingToNonNative
public boolean isDamagingToNonNative()Whether this terrain is damaging to non-native.- Returns:
- Whether this terrain is damaging to non-native.
-
isDamagingToWaterDweller
public boolean isDamagingToWaterDweller()Whether this terrain is damaging to water dweller.- Returns:
- Whether this terrain is damaging water dweller.
-
getSkillBonusRangestrikeThrough
public int getSkillBonusRangestrikeThrough(boolean rangestrikerIsNative) Return the bonus to apply to the Strike Factor of a Creature whose line-of-fire cross this hex. TODO there should be an effect variable (instead of 1), and we also might add the other variants (skillbonus, powerpenalty, powerbonus)- Returns:
- The bonus to apply to the Strike Factor, negative if it's a penalty.
-
getSkillPenaltyRangestrikeThrough
public int getSkillPenaltyRangestrikeThrough(boolean rangestrikerIsNative) Return the penalty to apply to the Strike Factor of a Creature whose line-of-fire cross this hex.- Returns:
- The penalty to apply to the Strike Factor, negative if it's a bonus.
-
isSand
public boolean isSand()USE ONLY FOR BATTLELANDBUILDER! -
isPlains
public boolean isPlains()USE ONLY FOR BATTLELANDBUILDER!
-