Package net.sf.colossus.variant
Class HazardTerrain
- java.lang.Object
-
- net.sf.colossus.variant.Hazards
-
- net.sf.colossus.variant.HazardTerrain
-
- All Implemented Interfaces:
HazardConstants
public class HazardTerrain extends Hazards
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
Fields Modifier and Type Field Description (package private) static HazardTerrain
BOG
static HazardTerrain
BRAMBLES
(package private) static HazardTerrain
DRIFT
(package private) static HazardTerrain
LAKE
Only waterdweller can enter a lake, but anybody can fly over it.private static java.util.logging.Logger
LOGGER
(package private) static HazardTerrain
PLAINS
(package private) static HazardTerrain
SAND
(package private) static HazardTerrain
SPRING
static HazardTerrain
STONE
Stone native gains 1 skill when defending against non-native ; Stone cannot be entered by non-native.(package private) static HazardTerrain
TARPIT
private static java.util.Map<java.lang.String,HazardTerrain>
TERRAIN_MAP
A map from the serialization string of a terrain to the instances.(package private) static HazardTerrain
TOWER
(package private) static HazardTerrain
TREE
Tree is a genuine Titan hazard, but the effect on anybody inside is custom, as noone can enter a tree in Titan.static HazardTerrain
VOLCANO
-
Fields inherited from class net.sf.colossus.variant.Hazards
attackEffect, defenseEffect, effectOnFlyerMovement, effectOnGroundMovement, rangedAttackEffect, rangedDefenseEffect, rangeStrikeSpecial, terrainSpecial
-
-
Constructor Summary
Constructors Constructor Description HazardTerrain(java.lang.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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
blocksFlyers()
boolean
blocksGround()
boolean
blocksLineOfSight()
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 java.util.Collection<HazardTerrain>
getAllHazardTerrains()
Returns all available hazard terrains.static HazardTerrain
getDefaultTerrain()
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(java.lang.String name)
Get the HazardTerrain by its name.boolean
isDamagingToNonNative()
Whether this terrain is damaging to non-native.boolean
isDamagingToWaterDweller()
Whether this terrain is damaging to water dweller.boolean
isFlyersNativeOnly()
boolean
isGroundNativeOnly()
boolean
isHealing()
Whether this terrain is healingboolean
isNativeBonusTerrain()
boolean
isNonNativePenaltyTerrain()
boolean
isPlains()
USE ONLY FOR BATTLELANDBUILDER!boolean
isSand()
USE ONLY FOR BATTLELANDBUILDER!boolean
isSlowingToNonNative()
Whether this terrain slows for the duration of the battleboolean
slows(boolean isNative, boolean isFlyer)
boolean
slowsFlyer(boolean isNative)
boolean
slowsGround(boolean isNative)
java.lang.String
toString()
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
TERRAIN_MAP
private static final java.util.Map<java.lang.String,HazardTerrain> TERRAIN_MAP
A map from the serialization string of a terrain to the instances.
-
PLAINS
static final HazardTerrain PLAINS
-
TREE
static final HazardTerrain 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
public static final HazardTerrain BRAMBLES
-
DRIFT
static final HazardTerrain DRIFT
-
VOLCANO
public static final HazardTerrain VOLCANO
-
BOG
static final HazardTerrain BOG
-
SAND
static final HazardTerrain SAND
-
TOWER
static final HazardTerrain TOWER
-
LAKE
static final HazardTerrain LAKE
Only waterdweller can enter a lake, but anybody can fly over it. No effect on combat.
-
STONE
public static final HazardTerrain 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
static final HazardTerrain SPRING
-
TARPIT
static final HazardTerrain TARPIT
-
-
Constructor Detail
-
HazardTerrain
public HazardTerrain(java.lang.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 Detail
-
isNativeBonusTerrain
public boolean isNativeBonusTerrain()
-
isNonNativePenaltyTerrain
public boolean isNonNativePenaltyTerrain()
-
getTerrainByName
public static HazardTerrain getTerrainByName(java.lang.String name)
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
public static HazardTerrain getDefaultTerrain()
-
getAllHazardTerrains
public static final java.util.Collection<HazardTerrain> 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
public java.lang.String 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 usescope
- The scope to usewhichIsBonus
- Which effect is a bonus (power || skill)whichIsPenalty
- Which effect is a penalty (power || skill)ovalue
- 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:
#getPowerBonusStrikeFrom(boolean, boolean) #getPowerPenaltyStrikeFrom(boolean, boolean)
-
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:
#getPowerBonusRangestrikeFrom(boolean, boolean) #getPowerPenaltyRangestrikeFrom(boolean, boolean)
-
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!
-
-