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 Hazards
Hazards.CombatEffectNested classes/interfaces inherited from interface HazardConstants
HazardConstants.EffectOnMovement, HazardConstants.EffectOnStrike, HazardConstants.RangeStrikeSpecialEffect, HazardConstants.ScopeOfEffectOnStrike, HazardConstants.SpecialEffect -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final HazardTerrainstatic final HazardTerrain(package private) static final HazardTerrain(package private) static final HazardTerrainOnly 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 HazardTerrainstatic final HazardTerrainStone native gains 1 skill when defending against non-native ; Stone cannot be entered by non-native.(package private) static final HazardTerrainprivate 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 HazardTerrainTree is a genuine Titan hazard, but the effect on anybody inside is custom, as noone can enter a tree in Titan.static final HazardTerrainFields inherited from class 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 TypeMethodDescriptionbooleanbooleanbooleanWhether this terrain blocks rangestrike.private intcomputeSkillOrPowerBonus(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 HazardTerrainintgetPowerBonusRangestrikeFrom(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.intgetPowerBonusRangestruckIn(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature Rangestruck in this terrain by a unspecified creature.intgetPowerBonusStrikeFrom(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.intgetPowerBonusStruckIn(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature struck in this terrain by a unspecified creature.intgetPowerPenaltyRangestrikeFrom(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.intgetPowerPenaltyRangestruckIn(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Strike Factor of a creature Rangestruck in this terrain by a unspecified creature.intgetPowerPenaltyStrikeFrom(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.intgetPowerPenaltyStruckIn(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Strike Factor of a creature struck in this terrain by a unspecified creature.intgetSkillBonusRangestrikeFrom(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature rangestriking out from that terrain.intgetSkillBonusRangestrikeThrough(boolean rangestrikerIsNative) Return the bonus to apply to the Strike Factor of a Creature whose line-of-fire cross this hex.intgetSkillBonusRangestruckIn(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature Rangestruck in this terrain.intgetSkillBonusStrikeFrom(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature striking out from that terrain.intgetSkillBonusStruckIn(boolean attackerIsNative, boolean defenderIsNative) Return the bonus to apply to the Strike Factor of a creature struck in this terrain.intgetSkillPenaltyRangestrikeFrom(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Strike Factor of a creature rangestriking out from that terrain.intgetSkillPenaltyRangestrikeThrough(boolean rangestrikerIsNative) Return the penalty to apply to the Strike Factor of a Creature whose line-of-fire cross this hex.intgetSkillPenaltyRangestruckIn(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Strike Factor of a creature Rangestruck in this terrain.intgetSkillPenaltyStrikeFrom(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Strike Factor of a creature striking out from that terrain.intgetSkillPenaltyStruckIn(boolean attackerIsNative, boolean defenderIsNative) Return the penalty to apply to the Strike Factor of a creature struck in this terrain.static HazardTerraingetTerrainByName(String name) Get the HazardTerrain by its name.booleanWhether this terrain is damaging to non-native.booleanWhether this terrain is damaging to water dweller.booleanbooleanbooleanWhether this terrain is healingbooleanbooleanbooleanisPlains()USE ONLY FOR BATTLELANDBUILDER!booleanisSand()USE ONLY FOR BATTLELANDBUILDER!booleanWhether this terrain slows for the duration of the battlebooleanslows(boolean isNative, boolean isFlyer) booleanslowsFlyer(boolean isNative) booleanslowsGround(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:
toStringin interfaceHazardConstants- Specified by:
toStringin 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!
-