Class 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.
    • 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.
      • 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.
      • 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.
    • 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
      • 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 here
        secondIsNative - Whether the second creature is native here
        effect - The effect to use
        scope - The scope to use
        whichIsBonus - 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 HazardTerrain
        defenderIsNative - 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 HazardTerrain
        defenderIsNative - 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 HazardTerrain
        defenderIsNative - 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 HazardTerrain
        defenderIsNative - 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 HazardTerrain
        defenderIsNative - 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 HazardTerrain
        defenderIsNative - 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 HazardTerrain
        defenderIsNative - 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 HazardTerrain
        defenderIsNative - 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 HazardTerrain
        defenderIsNative - 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 HazardTerrain
        defenderIsNative - 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 HazardTerrain
        defenderIsNative - 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 HazardTerrain
        defenderIsNative - 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 HazardTerrain
        defenderIsNative - 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 HazardTerrain
        defenderIsNative - 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 HazardTerrain
        defenderIsNative - 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 HazardTerrain
        defenderIsNative - 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!