Class CreatureType
java.lang.Object
net.sf.colossus.variant.CreatureType
- All Implemented Interfaces:
Comparable<CreatureType>
- Direct Known Subclasses:
CreatureTypeTitan
A type of creature in a variant.
This class models a generic creature type, i.e. all features that are common
through all creatures of a specific type.
Default equality and sorting order is class (in case of subclasses) then name.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final booleanprivate final booleanprivate final booleanprivate static final Loggerprivate final booleanprivate final booleanprivate intprivate final Stringstatic final Comparator<CreatureType> A comparator sorting creature types by name.private final booleanprivate final booleanprivate final booleanprivate final Set<HazardTerrain> private static booleanprivate final Stringprivate final intprivate final intprivate final booleanprivate final intprivate final intprivate final boolean -
Constructor Summary
ConstructorsConstructorDescriptionCreatureType(String name, int power, int skill, boolean rangestrikes, boolean flies, Set<HazardTerrain> nativeTerrains, boolean nativeSlope, boolean nativeRiver, boolean nativeDune, boolean waterDwelling, boolean magicMissile, boolean summonable, boolean lord, boolean demilord, int maxCount, String pluralName, String baseColor, int poison, int slows) -
Method Summary
Modifier and TypeMethodDescriptionbooleantrue if any if the values can change during the game returned by: - getPower, getSkill, (and therefore getPointValue) - isRangestriker, isFlier, useMagicMissile - isNativeTerraion(t), for all t - isNativeHexSide(h) for all h In Standard game only the titans change their attributesintfinal booleanCompare by name.protected StringString[]intGet the non-terrainified part of the kill-value.intgetName()The name used for creatures of this type.The name used for multiple creatures of this type.intintintgetPower()intgetSkill()intgetSlows()inthashCode()booleanbooleanisFlier()booleanbooleanisLord()booleanbooleanisNativeAt(char h) booleanisNativeAt(HazardHexside hazard) booleanbooleanisNativeIn(HazardTerrain terrain) Checks if the type of creature is native in a terrain type.booleanbooleanbooleanisPoison()booleanbooleanbooleanisTitan()Returns true if this is a Titan.booleanvoidsetMaxCount(int maxCount) Only called on Titans after numPlayers is known.static voidsetNoBaseColor(boolean b) booleanslows()toString()boolean
-
Field Details
-
LOGGER
-
NAME_ORDER
A comparator sorting creature types by name. -
noBaseColor
private static boolean noBaseColor -
name
-
pluralName
-
power
private final int power -
skill
private final int skill -
rangestrikes
private final boolean rangestrikes -
flies
private final boolean flies -
nativeSlope
private final boolean nativeSlope -
nativeRiver
private final boolean nativeRiver -
nativeDune
private final boolean nativeDune -
waterDwelling
private final boolean waterDwelling -
magicMissile
private final boolean magicMissile -
lord
private final boolean lord -
demilord
private final boolean demilord -
maxCount
private int maxCount -
poison
private final int poison -
slows
private final int slows -
baseColor
-
nativeTerrains
-
isSummonable
private final boolean isSummonable
-
-
Constructor Details
-
CreatureType
public CreatureType(String name, int power, int skill, boolean rangestrikes, boolean flies, Set<HazardTerrain> nativeTerrains, boolean nativeSlope, boolean nativeRiver, boolean nativeDune, boolean waterDwelling, boolean magicMissile, boolean summonable, boolean lord, boolean demilord, int maxCount, String pluralName, String baseColor, int poison, int slows)
-
-
Method Details
-
setNoBaseColor
public static void setNoBaseColor(boolean b) -
getName
The name used for creatures of this type. -
getPluralName
The name used for multiple creatures of this type. -
isNativeIn
Checks if the type of creature is native in a terrain type.- Parameters:
terrain- The terrain to check. Not null.- Returns:
- true iff creatures of this type are native in the terrain.
-
isSummonable
public boolean isSummonable() -
isTitan
public boolean isTitan()Returns true if this is a Titan. The default implementation is a constant false, to be overridden in classes representing Titans.- Returns:
- true iff this creature type is a Titan.
-
toString
-
equals
-
getMaxCount
public int getMaxCount() -
setMaxCount
public void setMaxCount(int maxCount) Only called on Titans after numPlayers is known. 08/2009 Clemens: And on Balrogs when players scores raise. -
isLord
public boolean isLord() -
isDemiLord
public boolean isDemiLord() -
isLordOrDemiLord
public boolean isLordOrDemiLord() -
isImmortal
public boolean isImmortal() -
canChangeValue
public boolean canChangeValue()true if any if the values can change during the game returned by: - getPower, getSkill, (and therefore getPointValue) - isRangestriker, isFlier, useMagicMissile - isNativeTerraion(t), for all t - isNativeHexSide(h) for all h In Standard game only the titans change their attributes -
getImageName
-
getImageNames
-
getPower
public int getPower() -
getSkill
public int getSkill() -
getPointValue
public int getPointValue() -
isRangestriker
public boolean isRangestriker() -
isFlier
public boolean isFlier() -
isPoison
public boolean isPoison() -
slows
public boolean slows() -
isNativeAt
-
isNativeAt
public boolean isNativeAt(char h) -
isNativeSlope
public boolean isNativeSlope() -
isNativeRiver
public boolean isNativeRiver() -
isNativeDune
public boolean isNativeDune() -
isWaterDwelling
public boolean isWaterDwelling() -
useMagicMissile
public boolean useMagicMissile() -
hashCode
-
getBaseColor
-
getPoison
public int getPoison() -
getSlows
public int getSlows() -
getKillValue
public int getKillValue()Get the non-terrainified part of the kill-value. TODO this is not model, but AI related (but also used in client for sorting creatures -- the client uses the AI for recruit hints, too) -
compareTo
- Specified by:
compareToin interfaceComparable<CreatureType>
-